home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-2.iso / Files II / Prog / B-C / Control Panel 0.9.5.sit / Control Panel Project 0.9.5 / MyPatch.c < prev    next >
MacBinary  |  1994-10-06  |  13.8 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: MyPatch.c

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Thu Oct 6 02:01:47 1994, modified Thu Oct 6 02:01:47 1994, creator Think C, type ASCII, 13560 bytes "MyPatch.c" , at 0x3578 382 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 09 4d 79 50 61 74 63 | 68 2e 63 00 00 00 00 00 |..MyPatc|h.c.....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 00 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 34 f8 00 | 00 01 7e aa b9 43 4b aa |.....4..|..~..CK.|
|00000060| b9 43 4b 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.CK.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 aa bc 00 00 |........|........|
|00000080| 2f 2a 0d 09 4d 79 50 61 | 74 63 68 2e 63 0d 0d 09 |/*..MyPa|tch.c...|
|00000090| 57 72 69 74 74 65 6e 20 | 62 79 20 4b 65 6e 20 57 |Written |by Ken W|
|000000a0| 6f 72 6c 65 79 2c 20 31 | 30 2f 30 34 2f 39 34 2c |orley, 1|0/04/94,|
|000000b0| 20 75 73 69 6e 67 20 53 | 79 6d 61 6e 74 65 63 20 | using S|ymantec |
|000000c0| 54 68 69 6e 6b 20 43 20 | 37 2e 30 2e 0d 09 43 6f |Think C |7.0...Co|
|000000d0| 70 79 72 69 67 68 74 20 | 31 39 39 34 2e 20 41 6c |pyright |1994. Al|
|000000e0| 6c 20 52 69 67 68 74 73 | 20 52 65 73 65 72 76 65 |l Rights| Reserve|
|000000f0| 64 2e 0d 09 0d 09 46 65 | 65 6c 20 66 72 65 65 20 |d.....Fe|el free |
|00000100| 74 6f 20 75 73 65 20 74 | 68 69 73 20 63 6f 64 65 |to use t|his code|
|00000110| 20 69 6e 20 61 20 70 61 | 74 63 68 20 6f 66 20 79 | in a pa|tch of y|
|00000120| 6f 75 72 20 6f 77 6e 2e | 20 20 50 6c 65 61 73 65 |our own.| Please|
|00000130| 20 64 6f 6e 27 74 0d 09 | 70 75 62 6c 69 73 68 20 | don't..|publish |
|00000140| 6f 72 20 64 69 73 74 72 | 69 62 75 74 65 20 74 68 |or distr|ibute th|
|00000150| 69 73 20 63 6f 64 65 20 | 77 69 74 68 6f 75 74 20 |is code |without |
|00000160| 67 69 76 69 6e 67 20 6d | 65 20 70 72 6f 70 65 72 |giving m|e proper|
|00000170| 20 63 72 65 64 69 74 2e | 0d 09 0d 09 54 68 69 73 | credit.|....This|
|00000180| 20 63 6f 64 65 20 69 73 | 20 73 65 74 20 75 70 20 | code is| set up |
|00000190| 74 6f 20 75 73 65 20 41 | 70 70 6c 65 27 73 20 22 |to use A|pple's "|
|000001a0| 55 6e 69 76 65 72 73 61 | 6c 20 48 65 61 64 65 72 |Universa|l Header|
|000001b0| 73 2e 22 20 20 49 66 20 | 79 6f 75 27 72 65 20 6e |s." If |you're n|
|000001c0| 6f 74 0d 09 75 73 69 6e | 67 20 74 68 6f 73 65 2c |ot..usin|g those,|
|000001d0| 20 73 6f 6d 65 20 73 6c | 69 67 68 74 20 6d 6f 64 | some sl|ight mod|
|000001e0| 69 66 69 63 61 74 69 6f | 6e 73 20 6d 61 79 20 62 |ificatio|ns may b|
|000001f0| 65 20 6e 65 63 65 73 73 | 61 72 79 20 28 63 68 61 |e necess|ary (cha|
|00000200| 6e 67 69 6e 67 0d 09 70 | 6f 69 6e 74 65 72 20 74 |nging..p|ointer t|
|00000210| 79 70 65 73 29 2e 0d 09 | 0d 09 54 68 69 73 20 69 |ypes)...|..This i|
|00000220| 73 20 74 68 65 20 27 74 | 61 73 6b 27 20 6f 72 20 |s the 't|ask' or |
|00000230| 27 70 61 74 63 68 27 20 | 70 6f 72 74 69 6f 6e 20 |'patch' |portion |
|00000240| 6f 66 20 74 68 65 20 63 | 6f 64 65 2e 20 20 54 68 |of the c|ode. Th|
|00000250| 65 20 49 4e 49 54 20 6f | 72 20 65 78 74 65 6e 73 |e INIT o|r extens|
|00000260| 69 6f 6e 0d 09 70 6f 72 | 74 69 6f 6e 20 6f 66 20 |ion..por|tion of |
|00000270| 74 68 65 20 63 6f 64 65 | 20 72 75 6e 73 20 61 74 |the code| runs at|
|00000280| 20 73 79 73 74 65 6d 20 | 73 74 61 72 74 75 70 20 | system |startup |
|00000290| 74 69 6d 65 2c 20 6c 6f | 61 64 73 20 74 68 69 73 |time, lo|ads this|
|000002a0| 20 70 69 65 63 65 20 6f | 66 20 63 6f 64 65 20 69 | piece o|f code i|
|000002b0| 6e 74 6f 0d 09 6d 65 6d | 6f 72 79 2c 20 61 6e 64 |nto..mem|ory, and|
|000002c0| 20 69 6e 73 74 61 6c 6c | 73 20 69 74 20 61 73 20 | install|s it as |
|000002d0| 61 20 70 61 74 63 68 20 | 74 6f 20 61 20 74 72 61 |a patch |to a tra|
|000002e0| 70 2e 0d 09 0d 09 54 68 | 69 73 20 63 6f 64 65 20 |p.....Th|is code |
|000002f0| 73 68 61 72 65 73 20 61 | 20 64 61 74 61 20 73 74 |shares a| data st|
|00000300| 72 75 63 74 75 72 65 20 | 77 69 74 68 20 74 68 65 |ructure |with the|
|00000310| 20 65 78 74 65 6e 73 69 | 6f 6e 20 70 6f 72 74 69 | extensi|on porti|
|00000320| 6f 6e 20 6f 66 20 74 68 | 65 20 63 6f 64 65 2c 0d |on of th|e code,.|
|00000330| 09 74 68 65 20 63 6f 6e | 74 72 6f 6c 20 70 61 6e |.the con|trol pan|
|00000340| 65 6c 20 63 6f 64 65 2c | 20 61 6e 64 20 70 6f 73 |el code,| and pos|
|00000350| 73 69 62 6c 79 20 77 69 | 74 68 20 6f 74 68 65 72 |sibly wi|th other|
|00000360| 20 63 6f 64 65 20 61 73 | 20 77 65 6c 6c 2e 20 20 | code as| well. |
|00000370| 4f 6e 65 20 6f 66 20 74 | 68 65 20 66 69 65 6c 64 |One of t|he field|
|00000380| 73 0d 09 69 6e 20 74 68 | 69 73 20 73 68 61 72 65 |s..in th|is share|
|00000390| 64 20 64 61 74 61 20 69 | 73 20 63 61 6c 6c 65 64 |d data i|s called|
|000003a0| 20 43 50 6f 6e 2e 20 20 | 54 68 69 73 20 66 69 65 | CPon. |This fie|
|000003b0| 6c 64 20 69 73 20 69 6e | 69 74 69 61 6c 6c 79 20 |ld is in|itially |
|000003c0| 73 65 74 20 62 79 20 74 | 68 65 0d 09 65 78 74 65 |set by t|he..exte|
|000003d0| 6e 73 69 6f 6e 20 62 61 | 73 65 64 20 6f 6e 20 74 |nsion ba|sed on t|
|000003e0| 68 65 20 76 61 6c 75 65 | 73 20 69 6e 20 74 68 65 |he value|s in the|
|000003f0| 20 27 70 72 65 66 27 20 | 72 65 73 6f 75 72 63 65 | 'pref' |resource|
|00000400| 2e 20 20 54 68 65 20 63 | 6f 6e 74 72 6f 6c 20 70 |. The c|ontrol p|
|00000410| 61 6e 65 6c 20 63 6f 64 | 65 0d 09 6d 61 79 20 6d |anel cod|e..may m|
|00000420| 6f 64 69 66 79 20 69 74 | 20 6c 61 74 65 72 20 62 |odify it| later b|
|00000430| 61 73 65 64 20 6f 6e 20 | 74 68 65 20 75 73 65 72 |ased on |the user|
|00000440| 27 73 20 63 68 6f 69 63 | 65 73 20 69 6e 20 74 68 |'s choic|es in th|
|00000450| 65 20 63 6f 6e 74 72 6f | 6c 20 70 61 6e 65 6c 2e |e contro|l panel.|
|00000460| 20 20 54 68 65 0d 09 66 | 69 65 6c 64 20 64 65 74 | The..f|ield det|
|00000470| 65 72 6d 69 6e 65 73 20 | 77 68 65 74 68 65 72 20 |ermines |whether |
|00000480| 77 65 20 74 61 6b 65 20 | 61 63 74 69 6f 6e 20 68 |we take |action h|
|00000490| 65 72 65 2c 20 6f 72 20 | 6a 75 6d 70 20 74 6f 20 |ere, or |jump to |
|000004a0| 74 68 65 20 6f 72 69 67 | 69 6e 61 6c 20 74 72 61 |the orig|inal tra|
|000004b0| 70 0d 09 77 69 74 68 6f | 75 74 20 6d 61 6b 69 6e |p..witho|ut makin|
|000004c0| 67 20 61 6e 79 20 6d 6f | 64 69 66 69 63 61 74 69 |g any mo|dificati|
|000004d0| 6f 6e 73 2e 0d 09 0d 09 | 41 20 70 6f 69 6e 74 65 |ons.....|A pointe|
|000004e0| 72 20 68 65 72 65 20 69 | 73 20 61 73 73 69 67 6e |r here i|s assign|
|000004f0| 65 64 20 74 6f 20 74 68 | 65 20 61 64 64 72 65 73 |ed to th|e addres|
|00000500| 73 20 30 78 31 32 33 34 | 35 36 37 38 2e 20 20 57 |s 0x1234|5678. W|
|00000510| 68 65 6e 20 74 68 65 20 | 65 78 74 65 6e 73 69 6f |hen the |extensio|
|00000520| 6e 20 63 6f 64 65 0d 09 | 6c 6f 61 64 73 20 74 68 |n code..|loads th|
|00000530| 69 73 20 63 6f 64 65 20 | 69 6e 74 6f 20 6d 65 6d |is code |into mem|
|00000540| 6f 72 79 2c 20 69 74 20 | 72 65 70 6c 61 63 65 73 |ory, it |replaces|
|00000550| 20 74 68 61 74 20 62 6f | 67 75 73 20 61 64 64 72 | that bo|gus addr|
|00000560| 65 73 73 20 77 69 74 68 | 20 74 68 65 20 61 64 64 |ess with| the add|
|00000570| 72 65 73 73 0d 09 6f 66 | 20 74 68 65 20 73 68 61 |ress..of| the sha|
|00000580| 72 65 64 20 64 61 74 61 | 20 73 74 72 75 63 74 75 |red data| structu|
|00000590| 72 65 20 69 6e 20 6d 65 | 6d 6f 72 79 2e 0d 09 0d |re in me|mory....|
|000005a0| 09 55 73 69 6e 67 20 72 | 6f 75 74 69 6e 65 73 20 |.Using r|outines |
|000005b0| 69 6e 20 74 68 65 20 41 | 4e 53 49 2d 41 34 20 6c |in the A|NSI-A4 l|
|000005c0| 69 62 72 61 72 79 20 28 | 6c 69 6b 65 20 76 73 70 |ibrary (|like vsp|
|000005d0| 72 69 6e 74 66 29 20 72 | 65 71 75 69 72 65 73 20 |rintf) r|equires |
|000005e0| 74 68 61 74 20 77 65 20 | 73 65 74 20 75 70 0d 09 |that we |set up..|
|000005f0| 74 68 65 20 41 34 20 72 | 65 67 69 73 74 65 72 20 |the A4 r|egister |
|00000600| 68 65 72 65 20 66 6f 72 | 20 61 63 63 65 73 73 20 |here for| access |
|00000610| 74 6f 20 67 6c 6f 62 61 | 6c 73 2e 20 20 43 75 72 |to globa|ls. Cur|
|00000620| 69 6f 75 73 6c 79 2c 20 | 77 68 65 6e 20 49 20 66 |iously, |when I f|
|00000630| 61 69 6c 65 64 20 74 6f | 20 64 6f 0d 09 74 68 61 |ailed to| do..tha|
|00000640| 74 2c 20 74 68 65 20 65 | 6e 64 20 72 65 73 75 6c |t, the e|nd resul|
|00000650| 74 20 77 6f 72 6b 65 64 | 20 66 69 6e 65 20 6f 6e |t worked| fine on|
|00000660| 20 6d 79 20 50 65 72 66 | 6f 72 6d 61 20 34 30 35 | my Perf|orma 405|
|00000670| 20 61 6e 64 20 63 72 61 | 73 68 65 64 20 6d 79 20 | and cra|shed my |
|00000680| 43 6c 61 73 73 69 63 2e | 0d 09 0d 09 42 55 49 4c |Classic.|....BUIL|
|00000690| 44 49 4e 47 20 54 48 45 | 20 43 4f 44 45 20 52 45 |DING THE| CODE RE|
|000006a0| 53 4f 55 52 43 45 0d 09 | 0d 09 09 54 68 69 73 20 |SOURCE..|...This |
|000006b0| 66 69 6c 65 20 73 68 6f | 75 6c 64 20 62 65 20 69 |file sho|uld be i|
|000006c0| 6e 63 6c 75 64 65 64 20 | 69 6e 20 61 20 70 72 6f |ncluded |in a pro|
|000006d0| 6a 65 63 74 20 6f 66 20 | 74 79 70 65 20 27 63 6f |ject of |type 'co|
|000006e0| 64 65 20 72 65 73 6f 75 | 72 63 65 27 20 77 69 74 |de resou|rce' wit|
|000006f0| 68 0d 09 09 4d 61 63 54 | 72 61 70 73 20 61 6e 64 |h...MacT|raps and|
|00000700| 20 41 4e 53 49 2d 41 34 | 2e 20 20 54 68 65 20 72 | ANSI-A4|. The r|
|00000710| 65 73 6f 75 72 63 65 20 | 74 79 70 65 20 73 68 6f |esource |type sho|
|00000720| 75 6c 64 20 62 65 20 77 | 68 61 74 65 76 65 72 20 |uld be w|hatever |
|00000730| 69 73 20 73 70 65 63 69 | 66 69 65 64 0d 09 09 69 |is speci|fied...i|
|00000740| 6e 20 74 68 65 20 4d 79 | 45 78 74 65 6e 73 69 6f |n the My|Extensio|
|00000750| 6e 2e 63 20 66 69 6c 65 | 20 28 62 79 20 61 20 23 |n.c file| (by a #|
|00000760| 64 65 66 69 6e 65 29 20 | 61 6e 64 20 74 68 65 20 |define) |and the |
|00000770| 49 44 20 73 68 6f 75 6c | 64 20 61 6c 73 6f 20 62 |ID shoul|d also b|
|00000780| 65 0d 09 09 77 68 61 74 | 65 76 65 72 20 69 73 20 |e...what|ever is |
|00000790| 73 70 65 63 69 66 69 65 | 64 20 69 6e 20 74 68 65 |specifie|d in the|
|000007a0| 20 4d 79 45 78 74 65 6e | 73 69 6f 6e 2e 63 20 66 | MyExten|sion.c f|
|000007b0| 69 6c 65 20 28 62 79 20 | 61 20 23 64 65 66 69 6e |ile (by |a #defin|
|000007c0| 65 29 2e 20 54 68 65 0d | 09 09 72 65 73 6f 75 72 |e). The.|..resour|
|000007d0| 63 65 20 61 74 74 72 69 | 62 75 74 65 73 20 73 68 |ce attri|butes sh|
|000007e0| 6f 75 6c 64 20 69 6e 64 | 69 63 61 74 65 20 74 68 |ould ind|icate th|
|000007f0| 61 74 20 74 68 69 73 20 | 72 65 73 6f 75 72 63 65 |at this |resource|
|00000800| 20 67 6f 65 73 20 69 6e | 20 74 68 65 20 73 79 73 | goes in| the sys|
|00000810| 74 65 6d 0d 09 09 68 65 | 61 70 20 61 6e 64 20 74 |tem...he|ap and t|
|00000820| 68 61 74 20 69 74 20 73 | 68 6f 75 6c 64 20 4e 4f |hat it s|hould NO|
|00000830| 54 20 62 65 20 6c 6f 63 | 6b 65 64 2e 0d 2a 2f 0d |T be loc|ked..*/.|
|00000840| 0d 2f 2a 20 50 52 4f 54 | 4f 54 59 50 45 53 20 2a |./* PROT|OTYPES *|
|00000850| 2f 0d 0d 76 6f 69 64 09 | 6d 61 69 6e 28 20 76 6f |/..void.|main( vo|
|00000860| 69 64 20 29 3b 0d 42 6f | 6f 6c 65 61 6e 09 53 74 |id );.Bo|olean.St|
|00000870| 72 43 6f 6d 70 61 72 65 | 28 20 53 74 72 32 35 35 |rCompare|( Str255|
|00000880| 20 73 74 72 31 2c 20 53 | 74 72 32 35 35 20 73 74 | str1, S|tr255 st|
|00000890| 72 32 20 29 3b 0d 0d 2f | 2a 20 49 4e 43 4c 55 44 |r2 );../|* INCLUD|
|000008a0| 45 44 20 46 49 4c 45 53 | 20 2a 2f 0d 0d 23 69 6e |ED FILES| */..#in|
|000008b0| 63 6c 75 64 65 20 22 4e | 6f 74 69 66 69 65 72 2e |clude "N|otifier.|
|000008c0| 68 22 09 09 2f 2a 20 70 | 72 6f 74 6f 74 79 70 65 |h"../* p|rototype|
|000008d0| 73 20 61 6e 64 20 69 6e | 63 6c 75 64 65 73 20 66 |s and in|cludes f|
|000008e0| 6f 72 20 53 74 72 46 6f | 72 6d 61 74 20 61 6e 64 |or StrFo|rmat and|
|000008f0| 20 53 74 72 4e 6f 74 69 | 66 79 20 2a 2f 0d 0d 23 | StrNoti|fy */..#|
|00000900| 69 6e 63 6c 75 64 65 20 | 22 53 68 61 72 65 64 44 |include |"SharedD|
|00000910| 61 74 61 2e 68 22 09 09 | 2f 2a 20 54 68 65 20 64 |ata.h"..|/* The d|
|00000920| 65 66 69 6e 69 74 69 6f | 6e 20 6f 66 20 6f 75 72 |efinitio|n of our|
|00000930| 20 73 68 61 72 65 64 20 | 64 61 74 61 20 73 74 72 | shared |data str|
|00000940| 75 63 74 75 72 65 2e 20 | 2a 2f 0d 09 09 09 09 09 |ucture. |*/......|
|00000950| 09 09 2f 2a 20 49 6e 63 | 6c 75 64 65 73 20 64 65 |../* Inc|ludes de|
|00000960| 66 69 6e 69 74 69 6f 6e | 73 20 6f 66 20 6d 79 44 |finition|s of myD|
|00000970| 61 74 61 53 74 72 75 63 | 74 2c 20 6d 79 44 61 74 |ataStruc|t, myDat|
|00000980| 61 50 74 72 2c 20 2a 2f | 0d 09 09 09 09 09 09 09 |aPtr, */|........|
|00000990| 2f 2a 20 61 6e 64 20 6d | 79 44 61 74 61 48 61 6e |/* and m|yDataHan|
|000009a0| 64 6c 65 20 74 6f 20 72 | 65 66 65 72 20 74 6f 20 |dle to r|efer to |
|000009b0| 74 68 69 73 20 64 61 74 | 61 2e 20 2a 2f 0d 0d 23 |this dat|a. */..#|
|000009c0| 69 6e 63 6c 75 64 65 20 | 3c 54 72 61 70 73 2e 68 |include |<Traps.h|
|000009d0| 3e 09 09 09 2f 2a 20 69 | 6e 63 6c 75 64 65 73 20 |>.../* i|ncludes |
|000009e0| 74 72 61 70 20 6e 61 6d | 65 73 20 6c 69 6b 65 20 |trap nam|es like |
|000009f0| 5f 42 6c 6f 63 6b 4d 6f | 76 65 20 2a 2f 0d 0d 23 |_BlockMo|ve */..#|
|00000a00| 69 6e 63 6c 75 64 65 20 | 3c 53 65 74 55 70 41 34 |include |<SetUpA4|
|00000a10| 2e 68 3e 0d 0d 2f 2a 20 | 46 55 4e 43 54 49 4f 4e |.h>../* |FUNCTION|
|00000a20| 53 20 2a 2f 0d 0d 76 6f | 69 64 09 6d 61 69 6e 28 |S */..vo|id.main(|
|00000a30| 20 76 6f 69 64 20 29 0d | 7b 0d 09 6d 79 44 61 74 | void ).|{..myDat|
|00000a40| 61 50 74 72 09 09 6d 79 | 44 61 74 61 3b 09 09 09 |aPtr..my|Data;...|
|00000a50| 2f 2a 20 61 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 |/* a poi|nter to |
|00000a60| 6f 75 72 20 73 68 61 72 | 65 64 20 64 61 74 61 20 |our shar|ed data |
|00000a70| 2a 2f 0d 09 6c 6f 6e 67 | 09 09 09 6f 6c 64 54 72 |*/..long|...oldTr|
|00000a80| 61 70 4c 6f 63 3b 09 09 | 2f 2a 20 6c 6f 63 61 6c |apLoc;..|/* local|
|00000a90| 20 76 61 72 20 74 6f 20 | 68 6f 6c 64 20 74 68 65 | var to |hold the|
|00000aa0| 20 6f 6c 64 20 74 72 61 | 70 20 72 6f 75 74 69 6e | old tra|p routin|
|00000ab0| 65 20 61 64 64 72 20 2a | 2f 0d 09 6c 6f 6e 67 09 |e addr *|/..long.|
|00000ac0| 09 09 70 42 79 74 65 73 | 2c 20 72 42 79 74 65 73 |..pBytes|, rBytes|
|00000ad0| 3b 09 2f 2a 20 76 61 72 | 73 20 66 6f 72 20 23 20 |;./* var|s for # |
|00000ae0| 6f 66 20 62 79 74 65 73 | 20 69 6e 20 70 61 72 61 |of bytes| in para|
|00000af0| 6d 73 20 26 20 72 65 74 | 75 72 6e 20 76 61 6c 20 |ms & ret|urn val |
|00000b00| 2a 2f 0d 09 42 6f 6f 6c | 65 61 6e 09 09 09 63 61 |*/..Bool|ean...ca|
|00000b10| 6c 6c 4f 72 69 67 69 6e | 61 6c 3b 09 2f 2a 20 74 |llOrigin|al;./* t|
|00000b20| 68 69 73 20 64 65 74 65 | 72 6d 69 6e 65 73 20 77 |his dete|rmines w|
|00000b30| 68 65 74 68 65 72 20 77 | 65 20 63 61 6c 6c 20 6f |hether w|e call o|
|00000b40| 72 69 67 20 74 72 61 70 | 20 2a 2f 0d 09 50 74 72 |rig trap| */..Ptr|
|00000b50| 09 09 09 09 70 61 72 61 | 6d 41 64 64 72 3b 09 09 |....para|mAddr;..|
|00000b60| 2f 2a 20 73 65 74 20 74 | 6f 20 74 68 65 20 61 64 |/* set t|o the ad|
|00000b70| 64 72 20 6f 66 20 74 68 | 65 20 70 61 72 61 6d 73 |dr of th|e params|
|00000b80| 20 6f 6e 20 74 68 65 20 | 73 74 61 63 6b 20 2a 2f | on the |stack */|
|00000b90| 0d 09 50 74 72 09 09 09 | 09 72 65 74 75 72 6e 41 |..Ptr...|.returnA|
|00000ba0| 64 64 72 3b 09 09 2f 2a | 20 73 65 74 20 74 6f 20 |ddr;../*| set to |
|00000bb0| 74 68 65 20 61 64 64 72 | 20 6f 66 20 74 68 65 20 |the addr| of the |
|00000bc0| 72 65 74 20 76 61 6c 20 | 6f 6e 20 74 68 65 20 73 |ret val |on the s|
|00000bd0| 74 61 63 6b 20 2a 2f 0d | 09 42 6f 6f 6c 65 61 6e |tack */.|.Boolean|
|00000be0| 09 09 09 74 61 6b 65 41 | 63 74 69 6f 6e 3b 09 09 |...takeA|ction;..|
|00000bf0| 2f 2a 20 74 68 69 73 20 | 66 6c 61 67 20 64 65 74 |/* this |flag det|
|00000c00| 65 72 6d 69 6e 65 73 20 | 77 68 65 74 68 65 72 20 |ermines |whether |
|00000c10| 74 68 69 73 20 74 72 61 | 70 20 68 61 73 20 2a 2f |this tra|p has */|
|00000c20| 0d 09 09 09 09 09 09 09 | 09 09 2f 2a 20 61 6e 79 |........|../* any|
|00000c30| 20 72 65 61 6c 20 65 66 | 66 65 63 74 20 2a 2f 0d | real ef|fect */.|
|00000c40| 09 0d 09 2f 2a 09 53 65 | 74 20 75 70 20 74 68 65 |.../*.Se|t up the|
|00000c50| 20 41 34 20 72 65 67 69 | 73 74 65 72 20 66 6f 72 | A4 regi|ster for|
|00000c60| 20 61 63 63 65 73 73 20 | 74 6f 20 73 74 61 74 69 | access |to stati|
|00000c70| 63 73 20 61 6e 64 20 67 | 6c 6f 62 61 6c 73 2e 20 |cs and g|lobals. |
|00000c80| 2a 2f 0d 09 0d 09 09 52 | 65 6d 65 6d 62 65 72 41 |*/.....R|ememberA|
|00000c90| 30 28 29 3b 0d 09 09 53 | 65 74 55 70 41 34 28 29 |0();...S|etUpA4()|
|00000ca0| 3b 0d 09 09 0d 09 2f 2a | 09 48 65 72 65 27 73 20 |;...../*|.Here's |
|00000cb0| 77 68 65 72 65 20 77 65 | 20 61 73 73 69 67 6e 20 |where we| assign |
|00000cc0| 61 20 62 6f 67 75 73 20 | 61 64 64 72 65 73 73 20 |a bogus |address |
|00000cd0| 74 6f 20 6f 75 72 20 64 | 61 74 61 20 73 74 72 75 |to our d|ata stru|
|00000ce0| 63 74 75 72 65 20 70 6f | 69 6e 74 65 72 2e 0d 09 |cture po|inter...|
|00000cf0| 20 2a 09 41 67 61 69 6e | 2c 20 74 68 69 73 20 77 | *.Again|, this w|
|00000d00| 69 6c 6c 20 62 65 20 65 | 64 69 74 65 64 20 62 79 |ill be e|dited by|
|00000d10| 20 74 68 65 20 65 78 74 | 65 6e 73 69 6f 6e 20 63 | the ext|ension c|
|00000d20| 6f 64 65 20 73 6f 20 74 | 68 61 74 20 69 74 20 62 |ode so t|hat it b|
|00000d30| 65 63 6f 6d 65 73 20 61 | 0d 09 20 2a 09 76 61 6c |ecomes a|.. *.val|
|00000d40| 69 64 20 61 64 64 72 65 | 73 73 20 28 75 73 69 6e |id addre|ss (usin|
|00000d50| 67 20 74 68 65 20 4d 75 | 6e 67 65 72 20 72 6f 75 |g the Mu|nger rou|
|00000d60| 74 69 6e 65 29 2e 20 20 | 59 6f 75 20 77 6f 6e 27 |tine). |You won'|
|00000d70| 74 20 6e 65 65 64 20 74 | 6f 20 63 68 61 6e 67 65 |t need t|o change|
|00000d80| 20 74 68 69 73 2e 0d 09 | 20 2a 2f 0d 09 09 0d 09 | this...| */.....|
|00000d90| 09 6d 79 44 61 74 61 20 | 3d 20 28 6d 79 44 61 74 |.myData |= (myDat|
|00000da0| 61 50 74 72 29 28 30 78 | 31 32 33 34 35 36 37 38 |aPtr)(0x|12345678|
|00000db0| 29 3b 0d 09 0d 09 2f 2a | 09 4e 6f 77 20 77 61 69 |);..../*|.Now wai|
|00000dc0| 74 20 75 6e 74 69 6c 20 | 74 68 65 20 73 68 61 72 |t until |the shar|
|00000dd0| 65 64 20 64 61 74 61 20 | 73 74 72 75 63 74 75 72 |ed data |structur|
|00000de0| 65 20 69 73 6e 27 74 20 | 69 6e 20 75 73 65 2c 20 |e isn't |in use, |
|00000df0| 74 68 65 6e 20 66 6c 61 | 67 20 69 74 20 61 73 0d |then fla|g it as.|
|00000e00| 09 20 2a 09 69 6e 20 75 | 73 65 20 75 6e 74 69 6c |. *.in u|se until|
|00000e10| 20 77 65 27 72 65 20 74 | 68 72 6f 75 67 68 20 77 | we're t|hrough w|
|00000e20| 69 74 68 20 69 74 2e 0d | 09 20 2a 2f 0d 09 20 0d |ith it..|. */.. .|
|00000e30| 09 20 09 77 68 69 6c 65 | 20 28 20 6d 79 44 61 74 |. .while| ( myDat|
|00000e40| 61 2d 3e 69 6e 55 73 65 | 20 29 20 7b 7d 0d 09 20 |a->inUse| ) {}.. |
|00000e50| 09 6d 79 44 61 74 61 2d | 3e 69 6e 55 73 65 20 3d |.myData-|>inUse =|
|00000e60| 20 74 72 75 65 3b 0d 09 | 0d 09 2f 2a 09 53 65 74 | true;..|../*.Set|
|00000e70| 20 74 68 65 20 74 61 6b | 65 41 63 74 69 6f 6e 20 | the tak|eAction |
|00000e80| 66 6c 61 67 20 77 68 69 | 63 68 20 77 69 6c 6c 20 |flag whi|ch will |
|00000e90| 64 65 74 65 72 6d 69 6e | 65 20 69 66 20 6f 75 72 |determin|e if our|
|00000ea0| 20 6d 6f 64 69 66 69 63 | 61 74 69 6f 6e 73 20 67 | modific|ations g|
|00000eb0| 65 74 0d 09 20 2a 09 65 | 78 65 63 75 74 65 64 20 |et.. *.e|xecuted |
|00000ec0| 6f 72 20 74 68 65 20 6f | 6c 64 20 74 72 61 70 20 |or the o|ld trap |
|00000ed0| 67 65 74 73 20 63 61 6c | 6c 65 64 20 61 6e 64 20 |gets cal|led and |
|00000ee0| 6e 6f 20 6d 6f 64 69 66 | 69 65 64 20 63 6f 64 65 |no modif|ied code|
|00000ef0| 20 69 73 20 65 78 65 63 | 75 74 65 64 2e 0d 09 20 | is exec|uted... |
|00000f00| 2a 2f 0d 09 20 0d 09 20 | 09 74 61 6b 65 41 63 74 |*/.. .. |.takeAct|
|00000f10| 69 6f 6e 20 3d 20 6d 79 | 44 61 74 61 2d 3e 43 50 |ion = my|Data->CP|
|00000f20| 6f 6e 3b 0d 09 20 09 0d | 09 2f 2a 09 47 65 74 20 |on;.. ..|./*.Get |
|00000f30| 74 68 65 20 6f 6c 64 20 | 74 72 61 70 20 6c 6f 63 |the old |trap loc|
|00000f40| 61 74 69 6f 6e 20 66 72 | 6f 6d 20 74 68 65 20 73 |ation fr|om the s|
|00000f50| 68 61 72 65 64 20 64 61 | 74 61 20 73 74 72 75 63 |hared da|ta struc|
|00000f60| 74 75 72 65 2e 20 20 41 | 6c 73 6f 20 67 65 74 20 |ture. A|lso get |
|00000f70| 74 68 65 0d 09 20 2a 09 | 73 69 7a 65 20 6f 66 20 |the.. *.|size of |
|00000f80| 74 68 65 20 70 61 72 61 | 6d 65 74 65 72 73 20 61 |the para|meters a|
|00000f90| 6e 64 20 72 65 74 75 72 | 6e 20 76 61 6c 75 65 20 |nd retur|n value |
|00000fa0| 66 6f 72 20 74 68 65 20 | 74 72 61 70 2e 20 20 59 |for the |trap. Y|
|00000fb0| 6f 75 20 73 68 6f 75 6c | 64 6e 27 74 20 6e 65 65 |ou shoul|dn't nee|
|00000fc0| 64 0d 09 20 2a 09 74 6f | 20 63 68 61 6e 67 65 20 |d.. *.to| change |
|00000fd0| 74 68 69 73 2e 0d 09 20 | 2a 2f 0d 09 0d 09 09 6f |this... |*/.....o|
|00000fe0| 6c 64 54 72 61 70 4c 6f | 63 20 3d 20 28 6c 6f 6e |ldTrapLo|c = (lon|
|00000ff0| 67 29 6d 79 44 61 74 61 | 2d 3e 6f 6c 64 54 72 61 |g)myData|->oldTra|
|00001000| 70 3b 0d 09 09 70 42 79 | 74 65 73 20 3d 20 6d 79 |p;...pBy|tes = my|
|00001010| 44 61 74 61 2d 3e 70 61 | 72 61 6d 42 79 74 65 73 |Data->pa|ramBytes|
|00001020| 3b 0d 09 09 72 42 79 74 | 65 73 20 3d 20 6d 79 44 |;...rByt|es = myD|
|00001030| 61 74 61 2d 3e 72 65 74 | 75 72 6e 42 79 74 65 73 |ata->ret|urnBytes|
|00001040| 3b 0d 09 0d 09 2f 2a 09 | 47 65 74 20 74 68 65 20 |;..../*.|Get the |
|00001050| 61 64 64 72 65 73 73 65 | 73 20 6f 66 20 74 68 65 |addresse|s of the|
|00001060| 20 70 61 72 61 6d 65 74 | 65 72 73 20 73 65 6e 74 | paramet|ers sent|
|00001070| 20 74 6f 20 74 68 65 20 | 74 72 61 70 20 61 6e 64 | to the |trap and|
|00001080| 20 74 68 65 20 73 70 61 | 63 65 20 72 65 73 65 72 | the spa|ce reser|
|00001090| 76 65 64 0d 09 20 2a 09 | 6f 6e 20 74 68 65 20 73 |ved.. *.|on the s|
|000010a0| 74 61 63 6b 20 66 6f 72 | 20 74 68 65 20 72 65 74 |tack for| the ret|
|000010b0| 75 72 6e 20 76 61 6c 75 | 65 2e 20 20 57 65 20 63 |urn valu|e. We c|
|000010c0| 61 6e 20 66 69 6e 64 20 | 74 68 65 73 65 20 61 73 |an find |these as|
|000010d0| 20 61 6e 20 6f 66 66 73 | 65 74 20 66 72 6f 6d 20 | an offs|et from |
|000010e0| 41 36 2e 0d 09 20 2a 09 | 54 68 65 20 61 64 64 72 |A6... *.|The addr|
|000010f0| 65 73 73 20 6f 66 20 74 | 68 65 20 70 61 72 61 6d |ess of t|he param|
|00001100| 65 74 65 72 73 20 67 6f | 65 73 20 69 6e 74 6f 20 |eters go|es into |
|00001110| 70 61 72 61 6d 41 64 64 | 72 20 61 6e 64 20 74 68 |paramAdd|r and th|
|00001120| 65 20 61 64 64 72 65 73 | 73 20 6f 66 20 74 68 65 |e addres|s of the|
|00001130| 0d 09 20 2a 09 73 70 61 | 63 65 20 72 65 73 65 72 |.. *.spa|ce reser|
|00001140| 76 65 64 20 66 6f 72 20 | 74 68 65 20 72 65 74 75 |ved for |the retu|
|00001150| 72 6e 20 76 61 6c 75 65 | 20 67 6f 65 73 20 69 6e |rn value| goes in|
|00001160| 74 6f 20 72 65 74 75 72 | 6e 41 64 64 72 2e 20 20 |to retur|nAddr. |
|00001170| 59 6f 75 20 73 68 6f 75 | 6c 64 6e 27 74 0d 09 20 |You shou|ldn't.. |
|00001180| 2a 09 6e 65 65 64 20 74 | 6f 20 63 68 61 6e 67 65 |*.need t|o change|
|00001190| 20 74 68 69 73 20 28 65 | 76 65 6e 20 69 66 20 69 | this (e|ven if i|
|000011a0| 74 27 73 20 61 20 72 65 | 67 69 73 74 65 72 20 62 |t's a re|gister b|
|000011b0| 61 73 65 64 20 72 6f 75 | 74 69 6e 65 20 69 6e 20 |ased rou|tine in |
|000011c0| 77 68 69 63 68 20 63 61 | 73 65 20 74 68 65 0d 09 |which ca|se the..|
|000011d0| 20 2a 09 76 61 6c 75 65 | 73 20 77 6f 75 6c 64 20 | *.value|s would |
|000011e0| 68 61 76 65 20 6e 6f 20 | 6d 65 61 6e 69 6e 67 29 |have no |meaning)|
|000011f0| 2e 0d 09 20 2a 2f 0d 09 | 20 0d 09 20 09 61 73 6d |... */..| .. .asm|
|00001200| 20 7b 0d 09 20 09 09 4d | 4f 56 45 2e 4c 09 41 36 | {.. ..M|OVE.L.A6|
|00001210| 2c 41 30 09 09 09 3b 63 | 6f 70 79 20 41 36 20 69 |,A0...;c|opy A6 i|
|00001220| 6e 74 6f 20 41 30 0d 09 | 20 09 09 41 44 44 2e 4c |nto A0..| ..ADD.L|
|00001230| 09 23 38 2c 41 30 09 09 | 09 3b 61 64 64 20 38 20 |.#8,A0..|.;add 8 |
|00001240| 74 6f 20 67 65 74 20 61 | 64 64 72 20 6f 66 20 6f |to get a|ddr of o|
|00001250| 72 69 67 69 6e 61 6c 20 | 70 61 72 61 6d 73 0d 09 |riginal |params..|
|00001260| 20 09 09 4d 4f 56 45 2e | 4c 09 41 30 2c 70 61 72 | ..MOVE.|L.A0,par|
|00001270| 61 6d 41 64 64 72 09 3b | 63 6f 70 79 20 61 64 64 |amAddr.;|copy add|
|00001280| 72 20 6f 66 20 70 61 72 | 61 6d 73 20 69 6e 74 6f |r of par|ams into|
|00001290| 20 6c 6f 63 61 6c 20 76 | 61 72 20 70 61 72 61 6d | local v|ar param|
|000012a0| 41 64 64 72 0d 09 20 09 | 09 41 44 44 2e 4c 09 70 |Addr.. .|.ADD.L.p|
|000012b0| 42 79 74 65 73 2c 41 30 | 09 09 3b 61 64 64 20 23 |Bytes,A0|..;add #|
|000012c0| 20 6f 66 20 70 61 72 61 | 6d 20 62 79 74 65 73 20 | of para|m bytes |
|000012d0| 74 6f 20 67 65 74 20 61 | 64 64 72 20 6f 66 20 72 |to get a|ddr of r|
|000012e0| 65 74 20 76 61 6c 75 65 | 0d 09 20 09 09 4d 4f 56 |et value|.. ..MOV|
|000012f0| 45 2e 4c 09 41 30 2c 72 | 65 74 75 72 6e 41 64 64 |E.L.A0,r|eturnAdd|
|00001300| 72 09 3b 63 6f 70 79 20 | 61 64 64 72 20 6f 66 20 |r.;copy |addr of |
|00001310| 72 65 74 20 76 61 6c 75 | 65 20 69 6e 74 6f 20 6c |ret valu|e into l|
|00001320| 6f 63 61 6c 20 76 61 72 | 20 72 65 74 75 72 6e 41 |ocal var| returnA|
|00001330| 64 64 72 0d 09 20 09 7d | 0d 0d 09 2f 2a 09 41 6e |ddr.. .}|.../*.An|
|00001340| 79 20 63 68 61 6e 67 65 | 73 20 74 6f 20 74 68 65 |y change|s to the|
|00001350| 20 6f 72 69 67 69 6e 61 | 6c 20 70 61 72 61 6d 65 | origina|l parame|
|00001360| 74 65 72 73 20 73 68 6f | 75 6c 64 20 62 65 20 64 |ters sho|uld be d|
|00001370| 6f 6e 65 20 68 65 72 65 | 20 28 75 73 75 61 6c 6c |one here| (usuall|
|00001380| 79 20 69 66 20 74 68 65 | 0d 09 20 2a 09 6f 72 69 |y if the|.. *.ori|
|00001390| 67 69 6e 61 6c 20 74 72 | 61 70 20 69 73 20 67 6f |ginal tr|ap is go|
|000013a0| 69 6e 67 20 74 6f 20 62 | 65 20 63 61 6c 6c 65 64 |ing to b|e called|
|000013b0| 29 2e 20 20 41 6c 73 6f | 2c 20 63 68 61 6e 67 65 |). Also|, change|
|000013c0| 73 20 74 6f 20 74 68 65 | 20 72 65 74 75 72 6e 20 |s to the| return |
|000013d0| 76 61 6c 75 65 0d 09 20 | 2a 09 63 61 6e 20 62 65 |value.. |*.can be|
|000013e0| 20 6d 61 64 65 20 68 65 | 72 65 20 28 75 73 75 61 | made he|re (usua|
|000013f0| 6c 6c 79 20 77 68 65 6e | 20 74 68 65 20 6f 72 69 |lly when| the ori|
|00001400| 67 69 6e 61 6c 20 74 72 | 61 70 20 69 73 20 4e 4f |ginal tr|ap is NO|
|00001410| 54 20 67 6f 69 6e 67 20 | 74 6f 20 62 65 20 63 61 |T going |to be ca|
|00001420| 6c 6c 65 64 29 2e 0d 09 | 20 2a 09 54 68 65 20 6c |lled)...| *.The l|
|00001430| 6f 63 61 6c 20 76 61 72 | 20 72 65 74 75 72 6e 41 |ocal var| returnA|
|00001440| 64 64 72 20 69 73 20 61 | 20 70 6f 69 6e 74 65 72 |ddr is a| pointer|
|00001450| 20 74 6f 20 74 68 65 20 | 70 6c 61 63 65 20 69 6e | to the |place in|
|00001460| 20 74 68 65 20 73 74 61 | 63 6b 20 77 68 65 72 65 | the sta|ck where|
|00001470| 20 74 68 65 0d 09 20 2a | 09 72 65 74 75 72 6e 20 | the.. *|.return |
|00001480| 76 61 6c 75 65 20 69 73 | 2e 20 20 52 65 6d 65 6d |value is|. Remem|
|00001490| 62 65 72 2c 20 62 65 66 | 6f 72 65 20 77 65 20 63 |ber, bef|ore we c|
|000014a0| 61 6c 6c 20 74 68 65 20 | 6f 72 69 67 69 6e 61 6c |all the |original|
|000014b0| 20 74 72 61 70 20 74 68 | 65 72 65 20 69 73 20 6e | trap th|ere is n|
|000014c0| 6f 0d 09 20 2a 09 72 65 | 74 75 72 6e 20 76 61 6c |o.. *.re|turn val|
|000014d0| 75 65 2e 2e 2e 6f 6e 6c | 79 20 61 20 73 70 61 63 |ue...onl|y a spac|
|000014e0| 65 20 66 6f 72 20 6f 6e | 65 20 73 6f 20 74 68 65 |e for on|e so the|
|000014f0| 20 76 61 6c 75 65 20 69 | 73 20 75 6e 64 65 66 69 | value i|s undefi|
|00001500| 6e 65 64 2e 20 20 49 66 | 20 77 65 27 72 65 20 6e |ned. If| we're n|
|00001510| 6f 74 0d 09 20 2a 09 67 | 6f 69 6e 67 20 74 6f 20 |ot.. *.g|oing to |
|00001520| 63 61 6c 6c 20 74 68 65 | 20 6f 72 69 67 69 6e 61 |call the| origina|
|00001530| 6c 20 74 72 61 70 2c 20 | 74 68 65 6e 20 77 65 20 |l trap, |then we |
|00001540| 63 61 6e 20 73 65 74 20 | 74 68 65 20 72 65 74 75 |can set |the retu|
|00001550| 72 6e 20 76 61 6c 75 65 | 20 68 65 72 65 20 74 6f |rn value| here to|
|00001560| 0d 09 20 2a 09 77 68 61 | 74 65 76 65 72 20 77 65 |.. *.wha|tever we|
|00001570| 20 77 61 6e 74 20 74 6f | 20 62 65 20 72 65 74 75 | want to| be retu|
|00001580| 72 6e 65 64 20 74 6f 20 | 74 68 65 20 63 61 6c 6c |rned to |the call|
|00001590| 69 6e 67 20 70 72 6f 67 | 72 61 6d 2e 20 20 49 66 |ing prog|ram. If|
|000015a0| 20 79 6f 75 20 6d 6f 64 | 69 66 79 20 74 68 65 0d | you mod|ify the.|
|000015b0| 09 20 2a 09 72 65 74 75 | 72 6e 20 76 61 6c 75 65 |. *.retu|rn value|
|000015c0| 20 68 65 72 65 2c 20 74 | 68 65 6e 20 63 61 6c 6c | here, t|hen call|
|000015d0| 20 74 68 65 20 6f 72 69 | 67 69 6e 61 6c 20 74 72 | the ori|ginal tr|
|000015e0| 61 70 2c 20 74 68 65 20 | 76 61 6c 75 65 20 77 69 |ap, the |value wi|
|000015f0| 6c 6c 20 62 65 20 6f 76 | 65 72 77 72 69 74 74 65 |ll be ov|erwritte|
|00001600| 6e 0d 09 20 2a 09 77 69 | 74 68 20 74 68 65 20 76 |n.. *.wi|th the v|
|00001610| 61 6c 75 65 20 72 65 74 | 75 72 6e 65 64 20 66 72 |alue ret|urned fr|
|00001620| 6f 6d 20 74 68 65 20 6f | 72 69 67 69 6e 61 6c 20 |om the o|riginal |
|00001630| 74 72 61 70 2e 20 20 54 | 68 65 20 65 61 73 69 65 |trap. T|he easie|
|00001640| 73 74 20 77 61 79 20 74 | 6f 20 61 63 63 65 73 73 |st way t|o access|
|00001650| 0d 09 20 2a 09 74 68 65 | 20 72 65 74 75 72 6e 20 |.. *.the| return |
|00001660| 76 61 6c 75 65 20 77 6f | 75 6c 64 20 62 65 20 74 |value wo|uld be t|
|00001670| 6f 20 64 65 63 6c 61 72 | 65 20 61 20 6c 6f 63 61 |o declar|e a loca|
|00001680| 6c 20 76 61 72 69 61 62 | 6c 65 20 61 73 20 61 20 |l variab|le as a |
|00001690| 70 6f 69 6e 74 65 72 20 | 74 6f 0d 09 20 2a 09 77 |pointer |to.. *.w|
|000016a0| 68 61 74 65 76 65 72 20 | 74 68 65 20 72 65 74 75 |hatever |the retu|
|000016b0| 72 6e 20 74 79 70 65 20 | 69 73 2c 20 74 68 65 6e |rn type |is, then|
|000016c0| 20 61 73 73 69 67 6e 20 | 72 65 74 75 72 6e 41 64 | assign |returnAd|
|000016d0| 64 72 20 74 6f 20 74 68 | 61 74 20 76 61 72 69 61 |dr to th|at varia|
|000016e0| 62 6c 65 20 63 61 73 74 | 69 6e 67 0d 09 20 2a 09 |ble cast|ing.. *.|
|000016f0| 69 74 20 74 6f 20 61 20 | 70 6f 69 6e 74 65 72 20 |it to a |pointer |
|00001700| 74 6f 20 74 68 65 20 63 | 6f 72 72 65 63 74 20 74 |to the c|orrect t|
|00001710| 79 70 65 2e 0d 09 20 2a | 2f 0d 09 0d 09 09 69 66 |ype... *|/.....if|
|00001720| 20 28 20 74 61 6b 65 41 | 63 74 69 6f 6e 20 29 0d | ( takeA|ction ).|
|00001730| 09 09 7b 0d 09 09 0d 09 | 09 09 2f 2a 09 49 20 64 |..{.....|../*.I d|
|00001740| 6f 6e 27 74 20 64 6f 20 | 61 6e 79 74 68 69 6e 67 |on't do |anything|
|00001750| 20 77 69 74 68 20 74 68 | 65 20 70 61 72 61 6d 65 | with th|e parame|
|00001760| 74 65 72 73 20 62 65 66 | 6f 72 65 20 74 68 65 20 |ters bef|ore the |
|00001770| 6f 72 69 67 69 6e 61 6c | 20 74 72 61 70 0d 09 09 |original| trap...|
|00001780| 09 20 2a 09 69 73 20 63 | 61 6c 6c 65 64 20 69 6e |. *.is c|alled in|
|00001790| 20 74 68 69 73 20 63 61 | 73 65 20 3a 2d 29 2e 0d | this ca|se :-)..|
|000017a0| 09 09 09 20 2a 0d 09 09 | 09 20 2a 09 45 78 61 6d |... *...|. *.Exam|
|000017b0| 70 6c 65 3a 20 20 49 66 | 20 74 68 65 20 72 65 74 |ple: If| the ret|
|000017c0| 75 72 6e 20 76 61 6c 75 | 65 20 77 61 73 20 61 20 |urn valu|e was a |
|000017d0| 50 6f 69 6e 74 20 28 73 | 61 6d 65 20 73 69 7a 65 |Point (s|ame size|
|000017e0| 20 61 73 20 61 20 6c 6f | 6e 67 2c 20 34 20 62 79 | as a lo|ng, 4 by|
|000017f0| 74 65 73 29 0d 09 09 09 | 20 2a 09 74 68 65 6e 20 |tes)....| *.then |
|00001800| 77 65 20 63 6f 75 6c 64 | 20 65 61 73 69 6c 79 20 |we could| easily |
|00001810| 61 63 63 65 73 73 20 69 | 74 20 61 73 20 66 6f 6c |access i|t as fol|
|00001820| 6c 6f 77 73 3a 0d 09 09 | 09 20 2a 0d 09 09 09 20 |lows:...|. *.... |
|00001830| 2a 09 44 65 63 6c 61 72 | 65 20 61 20 6c 6f 63 61 |*.Declar|e a loca|
|00001840| 6c 20 76 61 72 69 61 62 | 6c 65 20 61 74 20 74 68 |l variab|le at th|
|00001850| 65 20 62 65 67 69 6e 6e | 69 6e 67 20 6f 66 20 6d |e beginn|ing of m|
|00001860| 61 69 6e 20 6c 69 6b 65 | 20 73 6f 3a 0d 09 09 09 |ain like| so:....|
|00001870| 20 2a 0d 09 09 09 20 2a | 09 09 50 6f 69 6e 74 09 | *.... *|..Point.|
|00001880| 2a 6d 79 50 6f 69 6e 74 | 3b 0d 09 09 09 20 2a 0d |*myPoint|;.... *.|
|00001890| 09 09 09 20 2a 09 54 68 | 65 6e 20 61 73 73 69 67 |... *.Th|en assig|
|000018a0| 6e 20 72 65 74 75 72 6e | 41 64 64 72 20 74 6f 20 |n return|Addr to |
|000018b0| 6d 79 50 6f 69 6e 74 20 | 63 61 73 74 69 6e 67 20 |myPoint |casting |
|000018c0| 69 74 20 61 73 20 61 20 | 70 6f 69 6e 74 65 72 20 |it as a |pointer |
|000018d0| 74 6f 20 61 20 50 6f 69 | 6e 74 3a 0d 09 09 09 20 |to a Poi|nt:.... |
|000018e0| 2a 0d 09 09 09 20 2a 09 | 09 6d 79 50 6f 69 6e 74 |*.... *.|.myPoint|
|000018f0| 20 3d 20 28 50 6f 69 6e | 74 2a 29 72 65 74 75 72 | = (Poin|t*)retur|
|00001900| 6e 41 64 64 72 3b 0d 09 | 09 09 20 2a 09 09 0d 09 |nAddr;..|.. *....|
|00001910| 09 09 20 2a 09 4e 6f 77 | 20 77 65 20 63 61 6e 20 |.. *.Now| we can |
|00001920| 61 63 63 65 73 73 20 74 | 68 65 20 76 61 6c 75 65 |access t|he value|
|00001930| 3a 0d 09 09 09 20 2a 0d | 09 09 09 20 2a 09 09 6d |:.... *.|... *..m|
|00001940| 79 50 6f 69 6e 74 2d 3e | 68 20 3d 20 77 68 61 74 |yPoint->|h = what|
|00001950| 65 76 65 72 3b 0d 09 09 | 09 20 2a 2f 0d 09 09 09 |ever;...|. */....|
|00001960| 20 0d 09 20 09 7d 0d 09 | 0d 09 2f 2a 09 53 65 74 | .. .}..|../*.Set|
|00001970| 20 63 61 6c 6c 4f 72 69 | 67 69 6e 61 6c 20 73 6f | callOri|ginal so|
|00001980| 20 74 68 61 74 20 74 68 | 65 20 6f 72 69 67 69 6e | that th|e origin|
|00001990| 61 6c 20 74 72 61 70 20 | 77 69 6c 6c 20 62 65 20 |al trap |will be |
|000019a0| 63 61 6c 6c 65 64 2e 20 | 20 59 6f 75 20 6d 61 79 |called. | You may|
|000019b0| 20 77 61 6e 74 20 74 6f | 0d 09 20 2a 09 63 68 61 | want to|.. *.cha|
|000019c0| 6e 67 65 20 74 68 69 73 | 20 73 6f 20 74 68 61 74 |nge this| so that|
|000019d0| 20 63 61 6c 6c 4f 72 69 | 67 69 6e 61 6c 20 69 73 | callOri|ginal is|
|000019e0| 20 73 65 74 20 62 61 73 | 65 64 20 6f 6e 20 63 65 | set bas|ed on ce|
|000019f0| 72 74 61 69 6e 20 63 6f | 6e 64 69 74 69 6f 6e 73 |rtain co|nditions|
|00001a00| 2e 20 20 49 20 6a 75 73 | 74 0d 09 20 2a 09 73 65 |. I jus|t.. *.se|
|00001a10| 74 20 69 74 20 74 6f 20 | 74 72 75 65 20 68 65 72 |t it to |true her|
|00001a20| 65 20 73 6f 20 74 68 61 | 74 20 74 68 65 20 6f 72 |e so tha|t the or|
|00001a30| 69 67 69 6e 61 6c 20 74 | 72 61 70 20 69 73 20 63 |iginal t|rap is c|
|00001a40| 61 6c 6c 65 64 2e 20 20 | 59 6f 75 20 6d 61 79 20 |alled. |You may |
|00001a50| 77 61 6e 74 20 74 6f 0d | 09 20 2a 09 6a 75 73 74 |want to.|. *.just|
|00001a60| 20 73 65 74 20 69 74 20 | 74 6f 20 66 61 6c 73 65 | set it |to false|
|00001a70| 20 74 6f 20 61 76 6f 69 | 64 20 63 61 6c 6c 69 6e | to avoi|d callin|
|00001a80| 67 20 74 68 65 20 6f 72 | 69 67 69 6e 61 6c 20 74 |g the or|iginal t|
|00001a90| 72 61 70 20 69 66 20 79 | 6f 75 20 73 65 74 20 74 |rap if y|ou set t|
|00001aa0| 68 65 0d 09 20 2a 09 72 | 65 74 75 72 6e 20 76 61 |he.. *.r|eturn va|
|00001ab0| 6c 75 65 20 79 6f 75 72 | 73 65 6c 66 20 6f 72 20 |lue your|self or |
|00001ac0| 6a 75 73 74 20 64 6f 6e | 27 74 20 77 61 6e 74 20 |just don|'t want |
|00001ad0| 74 68 65 20 74 72 61 70 | 20 74 6f 20 68 61 76 65 |the trap| to have|
|00001ae0| 20 61 6e 79 20 65 66 66 | 65 63 74 20 28 77 68 65 | any eff|ect (whe|
|00001af0| 6e 0d 09 20 2a 09 74 68 | 65 72 65 20 69 73 20 6e |n.. *.th|ere is n|
|00001b00| 6f 20 72 65 74 75 72 6e | 20 76 61 6c 75 65 29 2e |o return| value).|
|00001b10| 0d 09 20 2a 2f 0d 09 0d | 09 09 63 61 6c 6c 4f 72 |.. */...|..callOr|
|00001b20| 69 67 69 6e 61 6c 20 3d | 20 74 72 75 65 3b 0d 09 |iginal =| true;..|
|00001b30| 0d 09 2f 2a 09 49 66 20 | 74 68 65 20 63 61 6c 6c |../*.If |the call|
|00001b40| 4f 72 69 67 69 6e 61 6c | 20 66 6c 61 67 20 69 73 |Original| flag is|
|00001b50| 20 74 72 75 65 20 4f 52 | 20 69 66 20 77 65 27 72 | true OR| if we'r|
|00001b60| 65 20 6e 6f 74 20 73 75 | 70 70 6f 73 65 64 20 74 |e not su|pposed t|
|00001b70| 6f 20 74 61 6b 65 20 61 | 6e 79 20 61 63 74 69 6f |o take a|ny actio|
|00001b80| 6e 0d 09 20 2a 09 68 65 | 72 65 2c 20 63 61 6c 6c |n.. *.he|re, call|
|00001b90| 20 74 68 65 20 6f 72 69 | 67 69 6e 61 6c 20 74 72 | the ori|ginal tr|
|00001ba0| 61 70 2e 0d 09 20 2a 2f | 0d 09 20 0d 09 69 66 20 |ap... */|.. ..if |
|00001bb0| 28 20 63 61 6c 6c 4f 72 | 69 67 69 6e 61 6c 20 7c |( callOr|iginal ||
|00001bc0| 7c 20 21 74 61 6b 65 41 | 63 74 69 6f 6e 20 29 0d || !takeA|ction ).|
|00001bd0| 09 7b 0d 09 09 50 74 72 | 09 74 6f 70 4f 66 53 74 |.{...Ptr|.topOfSt|
|00001be0| 61 63 6b 3b 0d 09 09 0d | 09 09 2f 2a 09 4d 61 6b |ack;....|../*.Mak|
|00001bf0| 65 20 73 70 61 63 65 20 | 66 6f 72 20 61 20 72 65 |e space |for a re|
|00001c00| 74 75 72 6e 20 76 61 6c | 75 65 20 28 69 66 20 61 |turn val|ue (if a|
|00001c10| 6e 79 29 20 61 6e 64 20 | 63 6f 70 79 20 74 68 65 |ny) and |copy the|
|00001c20| 20 6f 72 69 67 69 6e 61 | 6c 20 70 61 72 61 6d 65 | origina|l parame|
|00001c30| 74 65 72 73 20 74 6f 0d | 09 09 20 2a 09 74 68 65 |ters to.|.. *.the|
|00001c40| 20 74 6f 70 20 6f 66 20 | 74 68 65 20 73 74 61 63 | top of |the stac|
|00001c50| 6b 2e 20 20 54 68 65 6e | 20 6a 75 6d 70 20 74 6f |k. Then| jump to|
|00001c60| 20 74 68 65 20 6f 6c 64 | 20 74 72 61 70 20 6c 6f | the old| trap lo|
|00001c70| 63 61 74 69 6f 6e 20 75 | 73 69 6e 67 20 4a 53 52 |cation u|sing JSR|
|00001c80| 20 73 6f 0d 09 09 20 2a | 09 74 68 61 74 20 65 78 | so... *|.that ex|
|00001c90| 65 63 75 74 69 6f 6e 20 | 77 69 6c 6c 20 72 65 74 |ecution |will ret|
|00001ca0| 75 72 6e 20 68 65 72 65 | 2e 20 20 59 6f 75 20 73 |urn here|. You s|
|00001cb0| 68 6f 75 6c 64 6e 27 74 | 20 6e 65 65 64 20 74 6f |houldn't| need to|
|00001cc0| 20 63 68 61 6e 67 65 20 | 74 68 69 73 2e 0d 09 09 | change |this....|
|00001cd0| 20 2a 2f 0d 09 20 0d 09 | 20 09 09 61 73 6d 20 7b | */.. ..| ..asm {|
|00001ce0| 0d 09 20 09 09 09 53 55 | 42 2e 4c 09 72 42 79 74 |.. ...SU|B.L.rByt|
|00001cf0| 65 73 2c 53 50 09 09 3b | 6d 61 6b 65 20 73 70 61 |es,SP..;|make spa|
|00001d00| 63 65 20 6f 6e 20 73 74 | 61 63 6b 20 66 6f 72 20 |ce on st|ack for |
|00001d10| 72 65 74 75 72 6e 20 76 | 61 6c 75 65 0d 09 20 09 |return v|alue.. .|
|00001d20| 09 09 53 55 42 2e 4c 09 | 70 42 79 74 65 73 2c 53 |..SUB.L.|pBytes,S|
|00001d30| 50 09 09 3b 6d 61 6b 65 | 20 73 70 61 63 65 20 66 |P..;make| space f|
|00001d40| 6f 72 20 70 61 72 61 6d | 65 74 65 72 73 20 6f 6e |or param|eters on|
|00001d50| 20 73 74 61 63 6b 0d 09 | 20 09 09 09 0d 09 20 09 | stack..| ..... .|
|00001d60| 09 09 4d 4f 56 45 2e 4c | 09 53 50 2c 74 6f 70 4f |..MOVE.L|.SP,topO|
|00001d70| 66 53 74 61 63 6b 09 3b | 73 61 76 65 20 61 64 64 |fStack.;|save add|
|00001d80| 72 20 6f 66 20 74 6f 70 | 20 6f 66 20 73 74 61 63 |r of top| of stac|
|00001d90| 6b 20 69 6e 20 61 20 6c | 6f 63 61 6c 20 76 61 72 |k in a l|ocal var|
|00001da0| 0d 09 20 09 09 7d 0d 09 | 20 09 09 0d 09 20 09 09 |.. ..}..| .... ..|
|00001db0| 42 6c 6f 63 6b 4d 6f 76 | 65 28 20 70 61 72 61 6d |BlockMov|e( param|
|00001dc0| 41 64 64 72 2c 20 74 6f | 70 4f 66 53 74 61 63 6b |Addr, to|pOfStack|
|00001dd0| 2c 20 70 42 79 74 65 73 | 20 29 3b 20 2f 2a 20 63 |, pBytes| ); /* c|
|00001de0| 6f 70 79 20 6f 72 69 67 | 20 70 61 72 61 6d 73 20 |opy orig| params |
|00001df0| 74 6f 20 2a 2f 0d 09 20 | 09 09 09 09 09 09 09 09 |to */.. |........|
|00001e00| 09 09 09 09 09 2f 2a 20 | 74 6f 70 20 6f 66 20 73 |...../* |top of s|
|00001e10| 74 61 63 6b 20 2a 2f 0d | 09 20 09 09 61 73 6d 20 |tack */.|. ..asm |
|00001e20| 7b 0d 09 20 09 09 09 4d | 4f 56 45 2e 4c 09 6f 6c |{.. ...M|OVE.L.ol|
|00001e30| 64 54 72 61 70 4c 6f 63 | 2c 41 30 09 3b 70 75 74 |dTrapLoc|,A0.;put|
|00001e40| 20 61 64 64 72 20 6f 66 | 20 6f 72 69 67 20 74 72 | addr of| orig tr|
|00001e50| 61 70 20 69 6e 74 6f 20 | 41 30 0d 09 20 09 09 09 |ap into |A0.. ...|
|00001e60| 4a 53 52 09 09 28 41 30 | 29 09 09 09 3b 6a 75 6d |JSR..(A0|)...;jum|
|00001e70| 70 20 74 6f 20 74 68 65 | 20 6f 72 69 67 69 6e 61 |p to the| origina|
|00001e80| 6c 20 74 72 61 70 0d 09 | 20 09 09 7d 0d 0d 09 09 |l trap..| ..}....|
|00001e90| 2f 2a 09 45 78 65 63 75 | 74 69 6f 6e 20 72 65 74 |/*.Execu|tion ret|
|00001ea0| 75 72 6e 73 20 68 65 72 | 65 20 61 66 74 65 72 20 |urns her|e after |
|00001eb0| 63 61 6c 6c 69 6e 67 20 | 74 68 65 20 6f 72 69 67 |calling |the orig|
|00001ec0| 69 6e 61 6c 20 74 72 61 | 70 20 61 6e 64 20 74 68 |inal tra|p and th|
|00001ed0| 65 20 66 75 6e 63 74 69 | 6f 6e 0d 09 20 09 20 2a |e functi|on.. . *|
|00001ee0| 09 72 65 73 75 6c 74 20 | 69 73 20 6c 65 66 74 20 |.result |is left |
|00001ef0| 6f 6e 20 74 6f 70 20 6f | 66 20 74 68 65 20 73 74 |on top o|f the st|
|00001f00| 61 63 6b 2e 20 20 43 6f | 70 79 20 74 68 65 20 6e |ack. Co|py the n|
|00001f10| 65 77 20 72 65 73 75 6c | 74 20 69 6e 74 6f 20 74 |ew resul|t into t|
|00001f20| 68 65 20 73 70 61 63 65 | 0d 09 20 09 20 2a 09 61 |he space|.. . *.a|
|00001f30| 6c 6c 6f 63 61 74 65 64 | 20 66 6f 72 20 74 68 65 |llocated| for the|
|00001f40| 20 72 65 73 75 6c 74 20 | 77 68 65 6e 20 77 65 20 | result |when we |
|00001f50| 77 65 72 65 20 6f 72 69 | 67 69 6e 61 6c 6c 79 20 |were ori|ginally |
|00001f60| 63 61 6c 6c 65 64 2c 20 | 74 68 65 6e 20 70 6f 70 |called, |then pop|
|00001f70| 20 74 68 65 0d 09 20 09 | 20 2a 09 6e 65 77 20 72 | the.. .| *.new r|
|00001f80| 65 73 75 6c 74 20 76 61 | 6c 75 65 20 6f 66 66 20 |esult va|lue off |
|00001f90| 74 68 65 20 73 74 61 63 | 6b 2e 0d 09 20 09 20 2a |the stac|k... . *|
|00001fa0| 09 54 68 69 73 20 63 6f | 64 65 20 6f 6e 6c 79 20 |.This co|de only |
|00001fb0| 65 78 65 63 75 74 65 73 | 20 69 66 20 74 68 65 72 |executes| if ther|
|00001fc0| 65 20 69 73 20 61 20 72 | 65 74 75 72 6e 20 76 61 |e is a r|eturn va|
|00001fd0| 6c 75 65 20 28 69 66 20 | 72 42 79 74 65 73 20 69 |lue (if |rBytes i|
|00001fe0| 73 20 6e 6f 6e 7a 65 72 | 6f 29 2e 0d 09 20 09 20 |s nonzer|o)... . |
|00001ff0| 2a 09 59 6f 75 20 73 68 | 6f 75 6c 64 6e 27 74 20 |*.You sh|ouldn't |
|00002000| 6e 65 65 64 20 74 6f 20 | 63 68 61 6e 67 65 20 74 |need to |change t|
|00002010| 68 69 73 2e 0d 09 20 09 | 20 2a 2f 0d 09 20 09 20 |his... .| */.. . |
|00002020| 09 0d 09 20 09 20 09 69 | 66 20 28 20 72 42 79 74 |... . .i|f ( rByt|
|00002030| 65 73 20 29 0d 09 20 09 | 20 09 7b 0d 09 20 09 09 |es ).. .| .{.. ..|
|00002040| 20 09 61 73 6d 20 7b 0d | 09 20 09 09 20 09 09 4d | .asm {.|. .. ..M|
|00002050| 4f 56 45 2e 4c 09 53 50 | 2c 74 6f 70 4f 66 53 74 |OVE.L.SP|,topOfSt|
|00002060| 61 63 6b 09 09 3b 67 65 | 74 20 61 64 64 72 20 6f |ack..;ge|t addr o|
|00002070| 66 20 74 6f 70 20 6f 66 | 20 73 74 61 63 6b 20 28 |f top of| stack (|
|00002080| 73 6f 75 72 63 65 29 0d | 09 20 09 09 20 09 7d 0d |source).|. .. .}.|
|00002090| 09 20 09 09 20 09 0d 09 | 20 09 09 20 09 42 6c 6f |. .. ...| .. .Blo|
|000020a0| 63 6b 4d 6f 76 65 28 20 | 74 6f 70 4f 66 53 74 61 |ckMove( |topOfSta|
|000020b0| 63 6b 2c 20 72 65 74 75 | 72 6e 41 64 64 72 2c 20 |ck, retu|rnAddr, |
|000020c0| 72 42 79 74 65 73 20 29 | 3b 0d 0d 09 09 09 09 61 |rBytes )|;......a|
|000020d0| 73 6d 20 7b 0d 09 09 09 | 09 09 41 44 44 2e 4c 09 |sm {....|..ADD.L.|
|000020e0| 72 42 79 74 65 73 2c 53 | 50 09 09 09 3b 70 6f 70 |rBytes,S|P...;pop|
|000020f0| 20 6e 65 77 20 72 65 74 | 75 72 6e 20 76 61 6c 75 | new ret|urn valu|
|00002100| 65 20 6f 66 66 20 73 74 | 61 63 6b 0d 09 20 09 20 |e off st|ack.. . |
|00002110| 09 09 7d 0d 09 20 09 20 | 09 7d 0d 09 20 7d 09 2f |..}.. . |.}.. }./|
|00002120| 2a 20 65 6e 64 20 69 66 | 20 28 20 63 61 6c 6c 4f |* end if| ( callO|
|00002130| 72 69 67 69 6e 61 6c 20 | 7c 7c 20 21 74 61 6b 65 |riginal ||| !take|
|00002140| 41 63 74 69 6f 6e 20 29 | 20 2a 2f 0d 09 20 0d 09 |Action )| */.. ..|
|00002150| 2f 2a 09 49 66 20 79 6f | 75 20 6e 65 65 64 20 74 |/*.If yo|u need t|
|00002160| 6f 20 6d 6f 64 69 66 79 | 20 74 68 65 20 72 65 74 |o modify| the ret|
|00002170| 75 72 6e 20 76 61 6c 75 | 65 2c 20 64 6f 20 73 6f |urn valu|e, do so|
|00002180| 20 68 65 72 65 2e 20 20 | 49 74 73 20 61 64 64 72 | here. |Its addr|
|00002190| 20 69 73 20 73 74 69 6c | 6c 20 69 6e 0d 09 20 2a | is stil|l in.. *|
|000021a0| 09 72 65 74 75 72 6e 41 | 64 64 72 2e 20 20 49 66 |.returnA|ddr. If|
|000021b0| 20 74 68 65 20 6f 72 69 | 67 69 6e 61 6c 20 74 72 | the ori|ginal tr|
|000021c0| 61 70 20 77 61 73 20 63 | 61 6c 6c 65 64 2c 20 74 |ap was c|alled, t|
|000021d0| 68 65 20 76 61 6c 75 65 | 20 69 74 20 72 65 74 75 |he value| it retu|
|000021e0| 72 6e 65 64 20 28 69 66 | 20 61 6e 79 29 0d 09 20 |rned (if| any).. |
|000021f0| 2a 09 77 61 73 20 63 6f | 70 69 65 64 20 74 6f 20 |*.was co|pied to |
|00002200| 72 65 74 75 72 6e 41 64 | 64 72 2e 20 20 41 6c 73 |returnAd|dr. Als|
|00002210| 6f 2c 20 70 61 72 61 6d | 41 64 64 72 20 64 6f 65 |o, param|Addr doe|
|00002220| 73 20 73 74 69 6c 6c 20 | 70 6f 69 6e 74 20 74 6f |s still |point to|
|00002230| 20 74 68 65 20 70 61 72 | 61 6d 65 74 65 72 73 0d | the par|ameters.|
|00002240| 09 20 2a 09 69 66 20 79 | 6f 75 20 6e 65 65 64 20 |. *.if y|ou need |
|00002250| 74 6f 20 61 63 63 65 73 | 73 20 74 68 65 6d 20 73 |to acces|s them s|
|00002260| 74 69 6c 6c 2e 20 20 4d | 6f 64 69 66 79 69 6e 67 |till. M|odifying|
|00002270| 20 74 68 65 6d 20 61 74 | 20 74 68 69 73 20 70 6f | them at| this po|
|00002280| 69 6e 74 2c 20 68 6f 77 | 65 76 65 72 2c 20 77 6f |int, how|ever, wo|
|00002290| 75 6c 64 0d 09 20 2a 09 | 68 61 76 65 20 6e 6f 20 |uld.. *.|have no |
|000022a0| 65 66 66 65 63 74 20 73 | 69 6e 63 65 20 77 65 27 |effect s|ince we'|
|000022b0| 72 65 20 6a 75 73 74 20 | 61 62 6f 75 74 20 74 6f |re just |about to|
|000022c0| 20 70 6f 70 20 74 68 65 | 6d 20 6f 66 66 20 74 68 | pop the|m off th|
|000022d0| 65 20 73 74 61 63 6b 20 | 69 6e 74 6f 20 6f 62 6c |e stack |into obl|
|000022e0| 69 76 69 6f 6e 2e 0d 09 | 20 2a 09 52 65 6d 65 6d |ivion...| *.Remem|
|000022f0| 62 65 72 20 69 66 20 69 | 74 20 77 61 73 20 61 20 |ber if i|t was a |
|00002300| 70 6f 69 6e 74 65 72 20 | 6f 72 20 68 61 6e 64 6c |pointer |or handl|
|00002310| 65 20 74 68 61 74 20 77 | 61 73 20 73 65 6e 74 20 |e that w|as sent |
|00002320| 61 73 20 61 20 70 61 72 | 61 6d 65 74 65 72 2c 20 |as a par|ameter, |
|00002330| 74 68 61 74 20 76 61 6c | 75 65 0d 09 20 2a 09 77 |that val|ue.. *.w|
|00002340| 6f 6e 27 74 20 68 61 76 | 65 20 63 68 61 6e 67 65 |on't hav|e change|
|00002350| 64 2c 20 62 75 74 20 74 | 68 65 20 64 61 74 61 20 |d, but t|he data |
|00002360| 74 68 61 74 20 69 74 20 | 70 6f 69 6e 74 73 20 74 |that it |points t|
|00002370| 6f 20 6d 61 79 20 68 61 | 76 65 2e 20 20 49 66 20 |o may ha|ve. If |
|00002380| 79 6f 75 20 64 69 64 20 | 4e 4f 54 0d 09 20 2a 09 |you did |NOT.. *.|
|00002390| 63 61 6c 6c 20 74 68 65 | 20 6f 72 69 67 69 6e 61 |call the| origina|
|000023a0| 6c 20 74 72 61 70 20 61 | 6e 64 20 64 6f 20 4e 4f |l trap a|nd do NO|
|000023b0| 54 20 6d 6f 64 69 66 79 | 20 74 68 65 20 72 65 74 |T modify| the ret|
|000023c0| 75 72 6e 20 76 61 6c 75 | 65 20 68 65 72 65 2c 20 |urn valu|e here, |
|000023d0| 61 6e 64 20 74 68 65 72 | 65 20 49 53 0d 09 20 2a |and ther|e IS.. *|
|000023e0| 09 61 20 72 65 74 75 72 | 6e 20 76 61 6c 75 65 2c |.a retur|n value,|
|000023f0| 20 79 6f 75 27 6c 6c 20 | 62 65 20 72 65 74 75 72 | you'll |be retur|
|00002400| 6e 69 6e 67 20 47 41 52 | 42 41 47 45 20 74 6f 20 |ning GAR|BAGE to |
|00002410| 74 68 65 20 63 61 6c 6c | 69 6e 67 20 70 72 6f 67 |the call|ing prog|
|00002420| 72 61 6d 20 28 62 61 64 | 20 69 64 65 61 29 2e 0d |ram (bad| idea)..|
|00002430| 09 20 2a 0d 09 20 2a 09 | 49 20 62 65 6c 69 65 76 |. *.. *.|I believ|
|00002440| 65 20 74 68 61 74 20 74 | 61 6b 69 6e 67 20 61 63 |e that t|aking ac|
|00002450| 74 69 6f 6e 20 61 74 20 | 74 68 69 73 20 70 6f 69 |tion at |this poi|
|00002460| 6e 74 20 69 73 20 77 68 | 61 74 27 73 20 6b 6e 6f |nt is wh|at's kno|
|00002470| 77 6e 20 61 73 20 61 20 | 22 74 61 69 6c 20 70 61 |wn as a |"tail pa|
|00002480| 74 63 68 22 0d 09 20 2a | 09 77 68 69 63 68 20 69 |tch".. *|.which i|
|00002490| 73 20 67 65 6e 65 72 61 | 6c 6c 79 20 63 6f 6e 73 |s genera|lly cons|
|000024a0| 69 64 65 72 65 64 20 74 | 6f 20 62 65 20 22 69 6c |idered t|o be "il|
|000024b0| 6c 2d 61 64 76 69 73 65 | 64 2e 22 20 20 54 68 65 |l-advise|d." The|
|000024c0| 20 77 61 79 20 74 68 69 | 73 20 69 73 20 73 65 74 | way thi|s is set|
|000024d0| 20 75 70 2c 0d 09 20 2a | 09 68 6f 77 65 76 65 72 | up,.. *|.however|
|000024e0| 2c 20 49 20 64 6f 6e 27 | 74 20 73 65 65 20 68 6f |, I don'|t see ho|
|000024f0| 77 20 61 6e 79 74 68 69 | 6e 67 20 75 6e 66 6f 72 |w anythi|ng unfor|
|00002500| 73 65 65 6e 20 63 6f 75 | 6c 64 20 68 61 70 70 65 |seen cou|ld happe|
|00002510| 6e 20 61 73 20 6c 6f 6e | 67 20 61 73 20 77 65 27 |n as lon|g as we'|
|00002520| 72 65 0d 09 20 2a 09 63 | 61 72 65 66 75 6c 2e 0d |re.. *.c|areful..|
|00002530| 09 20 2a 2f 0d 09 20 0d | 09 20 69 66 20 28 20 74 |. */.. .|. if ( t|
|00002540| 61 6b 65 41 63 74 69 6f | 6e 20 29 0d 09 20 7b 0d |akeActio|n ).. {.|
|00002550| 09 20 0d 09 20 09 2f 2a | 09 54 68 65 20 72 65 74 |. .. ./*|.The ret|
|00002560| 75 72 6e 20 76 61 6c 75 | 65 20 66 72 6f 6d 20 4d |urn valu|e from M|
|00002570| 65 6e 75 53 65 6c 65 63 | 74 20 69 73 20 61 20 6c |enuSelec|t is a l|
|00002580| 6f 6e 67 20 69 6e 74 65 | 67 65 72 20 76 61 6c 75 |ong inte|ger valu|
|00002590| 65 20 77 68 6f 73 65 20 | 68 69 67 68 20 77 6f 72 |e whose |high wor|
|000025a0| 64 0d 09 20 09 20 2a 09 | 63 6f 6e 74 61 69 6e 73 |d.. . *.|contains|
|000025b0| 20 74 68 65 20 6d 65 6e | 75 20 69 64 20 28 7a 65 | the men|u id (ze|
|000025c0| 72 6f 20 69 66 20 6e 6f | 6e 65 20 73 65 6c 65 63 |ro if no|ne selec|
|000025d0| 74 65 64 29 20 61 6e 64 | 20 77 68 6f 73 65 20 6c |ted) and| whose l|
|000025e0| 6f 77 20 77 6f 72 64 20 | 63 6f 6e 74 61 69 6e 73 |ow word |contains|
|000025f0| 0d 09 20 09 20 2a 09 74 | 68 65 20 69 74 65 6d 20 |.. . *.t|he item |
|00002600| 6e 75 6d 62 65 72 20 73 | 65 6c 65 63 74 65 64 20 |number s|elected |
|00002610| 69 6e 20 74 68 61 74 20 | 6d 65 6e 75 20 28 75 6e |in that |menu (un|
|00002620| 64 65 66 69 6e 65 64 20 | 69 66 20 6e 6f 6e 65 20 |defined |if none |
|00002630| 73 65 6c 65 63 74 65 64 | 29 2e 0d 09 20 09 20 2a |selected|)... . *|
|00002640| 09 48 65 72 65 20 49 20 | 63 68 65 63 6b 20 74 6f |.Here I |check to|
|00002650| 20 73 65 65 20 69 66 20 | 74 68 65 20 6d 65 6e 75 | see if |the menu|
|00002660| 20 69 74 65 6d 20 73 65 | 6c 65 63 74 65 64 20 77 | item se|lected w|
|00002670| 61 73 20 22 41 62 6f 75 | 74 20 54 68 69 73 20 4d |as "Abou|t This M|
|00002680| 61 63 69 6e 74 6f 73 68 | 2e 2e 2e 22 0d 09 20 09 |acintosh|...".. .|
|00002690| 20 2a 09 61 6e 64 20 69 | 66 20 69 74 20 77 61 73 | *.and i|f it was|
|000026a0| 2c 20 49 20 70 75 74 20 | 75 70 20 61 20 4e 6f 74 |, I put |up a Not|
|000026b0| 69 66 69 63 61 74 69 6f | 6e 20 74 6f 20 62 72 61 |ificatio|n to bra|
|000026c0| 67 20 61 62 6f 75 74 20 | 6f 75 72 20 68 61 63 6b |g about |our hack|
|000026d0| 69 6e 67 20 70 72 6f 77 | 65 73 73 2e 0d 09 20 09 |ing prow|ess... .|
|000026e0| 20 2a 09 54 68 65 6e 20 | 49 20 72 65 74 75 72 6e | *.Then |I return|
|000026f0| 20 74 68 65 20 72 65 74 | 75 72 6e 20 76 61 6c 75 | the ret|urn valu|
|00002700| 65 20 75 6e 63 68 61 6e | 67 65 64 20 61 6e 64 20 |e unchan|ged and |
|00002710| 74 68 65 20 4d 61 63 69 | 6e 74 6f 73 68 20 69 6e |the Maci|ntosh in|
|00002720| 66 6f 20 64 69 61 6c 6f | 67 0d 09 20 09 20 2a 09 |fo dialo|g.. . *.|
|00002730| 77 69 6c 6c 20 63 6f 6d | 65 20 75 70 2e 0d 09 20 |will com|e up... |
|00002740| 09 20 2a 2f 0d 09 20 09 | 20 0d 09 20 09 20 09 7b |. */.. .| .. . .{|
|00002750| 09 2f 2a 20 69 73 6f 6c | 61 74 65 20 6f 75 72 20 |./* isol|ate our |
|00002760| 63 6f 64 65 20 61 6e 64 | 20 76 61 72 69 61 62 6c |code and| variabl|
|00002770| 65 73 20 68 65 72 65 20 | 69 6e 20 61 20 62 6c 6f |es here |in a blo|
|00002780| 63 6b 20 66 6f 72 20 6e | 65 61 74 6e 65 73 73 27 |ck for n|eatness'|
|00002790| 20 73 61 6b 65 20 2a 2f | 0d 09 20 09 20 09 0d 09 | sake */|.. . ...|
|000027a0| 20 09 20 09 09 73 68 6f | 72 74 09 09 2a 6d 65 6e | . ..sho|rt..*men|
|000027b0| 75 49 6e 66 6f 3b 0d 09 | 20 09 20 09 09 4d 65 6e |uInfo;..| . ..Men|
|000027c0| 75 48 61 6e 64 6c 65 09 | 6d 65 6e 75 48 3b 0d 09 |uHandle.|menuH;..|
|000027d0| 20 09 20 09 09 53 74 72 | 32 35 35 09 09 69 74 65 | . ..Str|255..ite|
|000027e0| 6d 53 74 72 69 6e 67 3b | 0d 09 20 09 20 09 09 53 |mString;|.. . ..S|
|000027f0| 74 72 32 35 35 09 09 63 | 6f 6d 70 53 74 72 69 6e |tr255..c|ompStrin|
|00002800| 67 20 3d 20 22 5c 70 41 | 62 6f 75 74 20 54 68 69 |g = "\pA|bout Thi|
|00002810| 73 20 4d 61 63 69 6e 74 | 6f 73 68 c9 22 3b 0d 09 |s Macint|osh.";..|
|00002820| 20 09 20 09 09 0d 09 20 | 09 20 09 09 2f 2a 20 42 | . .... |. ../* B|
|00002830| 79 20 74 68 65 20 77 61 | 79 2c 20 74 68 65 20 74 |y the wa|y, the t|
|00002840| 68 72 65 65 20 64 6f 74 | 73 20 61 74 20 74 68 65 |hree dot|s at the|
|00002850| 20 65 6e 64 20 6f 66 20 | 73 6f 6d 65 20 6d 65 6e | end of |some men|
|00002860| 75 20 69 74 65 6d 73 20 | 61 72 65 20 4e 4f 54 20 |u items |are NOT |
|00002870| 2a 2f 0d 09 20 09 20 09 | 09 2f 2a 20 74 68 72 65 |*/.. . .|./* thre|
|00002880| 65 20 70 65 72 69 6f 64 | 73 2c 20 74 68 65 79 20 |e period|s, they |
|00002890| 61 72 65 20 6f 6e 65 20 | 63 68 61 72 61 63 74 65 |are one |characte|
|000028a0| 72 2d 2d 61 6e 20 6f 70 | 74 69 6f 6e 20 73 65 6d |r--an op|tion sem|
|000028b0| 69 2d 63 6f 6c 6f 6e 20 | 2a 2f 0d 09 20 09 20 09 |i-colon |*/.. . .|
|000028c0| 09 0d 09 20 09 20 09 2f | 2a 09 41 73 73 69 67 6e |... . ./|*.Assign|
|000028d0| 20 72 65 74 75 72 6e 41 | 64 64 72 20 74 6f 20 6d | returnA|ddr to m|
|000028e0| 65 6e 75 49 6e 66 6f 20 | 2d 20 61 20 70 6f 69 6e |enuInfo |- a poin|
|000028f0| 74 65 72 20 74 6f 20 61 | 20 73 68 6f 72 74 20 2a |ter to a| short *|
|00002900| 2f 0d 09 20 09 20 09 0d | 09 20 09 20 09 09 6d 65 |/.. . ..|. . ..me|
|00002910| 6e 75 49 6e 66 6f 20 3d | 20 28 73 68 6f 72 74 2a |nuInfo =| (short*|
|00002920| 29 72 65 74 75 72 6e 41 | 64 64 72 3b 0d 09 20 09 |)returnA|ddr;.. .|
|00002930| 20 09 0d 09 20 09 20 09 | 2f 2a 09 4e 6f 77 20 77 | ... . .|/*.Now w|
|00002940| 65 20 63 61 6e 20 75 73 | 65 20 6d 65 6e 75 49 6e |e can us|e menuIn|
|00002950| 66 6f 5b 30 5d 20 74 6f | 20 61 63 63 65 73 73 20 |fo[0] to| access |
|00002960| 74 68 65 20 68 69 67 68 | 20 77 6f 72 64 20 28 6d |the high| word (m|
|00002970| 65 6e 75 20 69 64 23 29 | 0d 09 20 09 20 09 20 2a |enu id#)|.. . . *|
|00002980| 09 61 6e 64 20 6d 65 6e | 75 49 6e 66 6f 5b 31 5d |.and men|uInfo[1]|
|00002990| 20 74 6f 20 61 63 63 65 | 73 73 20 74 68 65 20 6c | to acce|ss the l|
|000029a0| 6f 77 20 77 6f 72 64 20 | 28 74 68 65 20 69 74 65 |ow word |(the ite|
|000029b0| 6d 23 29 2e 0d 09 20 09 | 20 09 20 2a 2f 0d 09 20 |m#)... .| . */.. |
|000029c0| 09 20 09 20 09 69 66 20 | 28 20 6d 65 6e 75 49 6e |. . .if |( menuIn|
|000029d0| 66 6f 5b 30 5d 20 29 09 | 2f 2a 20 69 66 20 61 20 |fo[0] ).|/* if a |
|000029e0| 6d 65 6e 75 20 69 74 65 | 6d 20 77 61 73 20 73 65 |menu ite|m was se|
|000029f0| 6c 65 63 74 65 64 2c 20 | 77 69 6c 6c 20 62 65 20 |lected, |will be |
|00002a00| 6e 6f 6e 7a 65 72 6f 20 | 2a 2f 0d 09 20 09 20 09 |nonzero |*/.. . .|
|00002a10| 20 09 7b 0d 09 20 09 20 | 09 20 09 09 6d 65 6e 75 | .{.. . |. ..menu|
|00002a20| 48 20 3d 20 47 65 74 4d | 48 61 6e 64 6c 65 28 20 |H = GetM|Handle( |
|00002a30| 6d 65 6e 75 49 6e 66 6f | 5b 30 5d 20 29 3b 09 2f |menuInfo|[0] );./|
|00002a40| 2a 20 67 65 74 20 61 20 | 68 61 6e 64 6c 65 20 74 |* get a |handle t|
|00002a50| 6f 20 74 68 65 20 6d 65 | 6e 75 20 2a 2f 0d 09 20 |o the me|nu */.. |
|00002a60| 09 20 09 20 09 09 47 65 | 74 49 74 65 6d 28 20 6d |. . ..Ge|tItem( m|
|00002a70| 65 6e 75 48 2c 20 6d 65 | 6e 75 49 6e 66 6f 5b 31 |enuH, me|nuInfo[1|
|00002a80| 5d 2c 20 69 74 65 6d 53 | 74 72 69 6e 67 20 29 3b |], itemS|tring );|
|00002a90| 09 2f 2a 20 67 65 74 20 | 6d 65 6e 75 20 69 74 65 |./* get |menu ite|
|00002aa0| 6d 20 74 65 78 74 20 2a | 2f 0d 09 20 09 20 09 20 |m text *|/.. . . |
|00002ab0| 09 09 0d 09 20 09 20 09 | 20 09 09 69 66 20 28 20 |.... . .| ..if ( |
|00002ac0| 53 74 72 43 6f 6d 70 61 | 72 65 28 20 69 74 65 6d |StrCompa|re( item|
|00002ad0| 53 74 72 69 6e 67 2c 20 | 63 6f 6d 70 53 74 72 69 |String, |compStri|
|00002ae0| 6e 67 20 29 20 29 0d 09 | 20 09 20 09 20 09 09 7b |ng ) )..| . . ..{|
|00002af0| 0d 09 20 09 20 09 20 09 | 09 09 2f 2a 20 48 65 72 |.. . . .|../* Her|
|00002b00| 65 27 73 20 61 6e 20 65 | 78 61 6d 70 6c 65 20 6f |e's an e|xample o|
|00002b10| 66 20 75 73 69 6e 67 20 | 74 68 65 20 4e 6f 74 69 |f using |the Noti|
|00002b20| 66 69 63 61 74 69 6f 6e | 20 6d 61 6e 61 67 65 72 |fication| manager|
|00002b30| 20 74 68 72 6f 75 67 68 | 0d 09 20 09 20 09 20 09 | through|.. . . .|
|00002b40| 09 09 20 2a 20 74 68 65 | 20 53 74 72 46 6f 72 6d |.. * the| StrForm|
|00002b50| 61 74 20 61 6e 64 20 53 | 74 72 4e 6f 74 69 66 79 |at and S|trNotify|
|00002b60| 20 72 6f 75 74 69 6e 65 | 73 2e 20 20 53 74 72 46 | routine|s. StrF|
|00002b70| 6f 72 6d 61 74 20 77 6f | 72 6b 73 20 6c 69 6b 65 |ormat wo|rks like|
|00002b80| 0d 09 20 09 20 09 20 09 | 09 09 20 2a 20 70 72 69 |.. . . .|.. * pri|
|00002b90| 6e 74 66 2e 20 20 44 6f | 20 4e 4f 54 20 70 75 74 |ntf. Do| NOT put|
|00002ba0| 20 61 20 22 5c 70 22 20 | 61 74 20 74 68 65 20 62 | a "\p" |at the b|
|00002bb0| 65 67 69 6e 6e 69 6e 67 | 20 6f 66 20 74 68 65 20 |eginning| of the |
|00002bc0| 73 74 72 69 6e 67 2e 0d | 09 20 09 20 09 20 09 09 |string..|. . . ..|
|00002bd0| 09 20 2a 2f 0d 09 09 09 | 09 09 09 53 74 72 46 6f |. */....|...StrFo|
|00002be0| 72 6d 61 74 28 20 6d 79 | 44 61 74 61 2d 3e 73 74 |rmat( my|Data->st|
|00002bf0| 72 2c 20 22 48 61 21 20 | 48 61 21 20 20 48 61 63 |r, "Ha! |Ha! Hac|
|00002c00| 6b 65 72 73 20 64 6f 20 | 69 74 20 22 0d 09 09 09 |kers do |it "....|
|00002c10| 09 09 09 09 22 61 74 20 | 73 79 73 74 65 6d 20 6c |...."at |system l|
|00002c20| 65 76 65 6c 21 20 20 22 | 0d 09 09 09 09 09 09 09 |evel! "|........|
|00002c30| 22 4d 65 6e 75 20 23 25 | 64 2c 20 49 74 65 6d 20 |"Menu #%|d, Item |
|00002c40| 23 25 64 2e 22 2c 20 6d | 65 6e 75 49 6e 66 6f 5b |#%d.", m|enuInfo[|
|00002c50| 30 5d 2c 20 6d 65 6e 75 | 49 6e 66 6f 5b 31 5d 20 |0], menu|Info[1] |
|00002c60| 29 3b 0d 09 09 09 09 09 | 09 53 74 72 4e 6f 74 69 |);......|.StrNoti|
|00002c70| 66 79 28 20 26 28 6d 79 | 44 61 74 61 2d 3e 6e 6d |fy( &(my|Data->nm|
|00002c80| 29 2c 20 26 28 6d 79 44 | 61 74 61 2d 3e 73 74 72 |), &(myD|ata->str|
|00002c90| 29 20 29 3b 0d 09 20 09 | 20 09 20 09 09 7d 0d 09 |) );.. .| . ..}..|
|00002ca0| 20 09 20 09 20 09 7d 0d | 09 20 09 20 09 7d 0d 09 | . . .}.|. . .}..|
|00002cb0| 20 09 20 09 0d 09 20 7d | 09 2f 2a 20 65 6e 64 20 | . ... }|./* end |
|00002cc0| 69 66 20 28 20 6d 79 44 | 61 74 61 2d 3e 70 61 74 |if ( myD|ata->pat|
|00002cd0| 63 68 41 63 74 69 6f 6e | 20 29 0d 09 20 0d 09 20 |chAction| ).. .. |
|00002ce0| 2f 2a 09 4e 6f 77 20 77 | 65 27 72 65 20 74 68 72 |/*.Now w|e're thr|
|00002cf0| 6f 75 67 68 20 77 69 74 | 68 20 74 68 65 20 73 68 |ough wit|h the sh|
|00002d00| 61 72 65 64 20 64 61 74 | 61 20 2a 2f 0d 09 20 0d |ared dat|a */.. .|
|00002d10| 09 20 09 6d 79 44 61 74 | 61 2d 3e 69 6e 55 73 65 |. .myDat|a->inUse|
|00002d20| 20 3d 20 66 61 6c 73 65 | 3b 0d 09 20 0d 09 20 2f | = false|;.. .. /|
|00002d30| 2a 20 52 65 73 74 6f 72 | 65 20 74 68 65 20 41 34 |* Restor|e the A4|
|00002d40| 20 72 65 67 69 73 74 65 | 72 20 74 6f 20 69 74 73 | registe|r to its|
|00002d50| 20 70 72 65 76 69 6f 75 | 73 20 76 61 6c 75 65 20 | previou|s value |
|00002d60| 2a 2f 0d 09 20 0d 09 20 | 09 52 65 73 74 6f 72 65 |*/.. .. |.Restore|
|00002d70| 41 34 28 29 3b 0d 09 20 | 09 0d 09 20 2f 2a 09 46 |A4();.. |... /*.F|
|00002d80| 69 6e 69 73 68 20 75 70 | 20 62 79 20 75 6e 6c 69 |inish up| by unli|
|00002d90| 6e 6b 69 6e 67 20 41 36 | 20 28 54 68 69 6e 6b 20 |nking A6| (Think |
|00002da0| 43 20 61 75 74 6f 6d 61 | 74 69 63 61 6c 6c 79 20 |C automa|tically |
|00002db0| 6c 69 6e 6b 73 20 41 36 | 20 6f 6e 20 65 6e 74 72 |links A6| on entr|
|00002dc0| 79 0d 09 20 20 2a 09 74 | 6f 20 74 68 65 20 72 6f |y.. *.t|o the ro|
|00002dd0| 75 74 69 6e 65 2e 20 20 | 49 74 20 61 6c 73 6f 20 |utine. |It also |
|00002de0| 75 6e 6c 69 6e 6b 73 20 | 69 74 20 61 75 74 6f 6d |unlinks |it autom|
|00002df0| 61 74 69 63 61 6c 6c 79 | 20 61 74 20 74 68 65 20 |atically| at the |
|00002e00| 65 6e 64 20 6f 66 20 74 | 68 65 20 72 6f 75 74 69 |end of t|he routi|
|00002e10| 6e 65 2c 0d 09 20 20 2a | 09 62 75 74 20 77 65 27 |ne,.. *|.but we'|
|00002e20| 72 65 20 67 6f 69 6e 67 | 20 74 6f 20 6a 75 6d 70 |re going| to jump|
|00002e30| 20 6f 75 74 20 62 65 66 | 6f 72 65 20 74 68 65 20 | out bef|ore the |
|00002e40| 61 63 74 75 61 6c 20 65 | 6e 64 20 6f 66 20 74 68 |actual e|nd of th|
|00002e50| 65 20 72 6f 75 74 69 6e | 65 2e 29 2c 0d 09 20 20 |e routin|e.),.. |
|00002e60| 2a 09 72 65 6d 6f 76 69 | 6e 67 20 74 68 65 20 6f |*.removi|ng the o|
|00002e70| 72 69 67 69 6e 61 6c 20 | 70 61 72 61 6d 65 74 65 |riginal |paramete|
|00002e80| 72 73 20 66 72 6f 6d 20 | 74 68 65 20 73 74 61 63 |rs from |the stac|
|00002e90| 6b 2c 20 61 6e 64 20 6a | 75 6d 70 69 6e 67 20 74 |k, and j|umping t|
|00002ea0| 6f 20 74 68 65 20 72 65 | 74 75 72 6e 0d 09 20 20 |o the re|turn.. |
|00002eb0| 2a 09 61 64 64 72 65 73 | 73 2e 20 20 59 6f 75 20 |*.addres|s. You |
|00002ec0| 73 68 6f 75 6c 64 6e 27 | 74 20 6e 65 65 64 20 74 |shouldn'|t need t|
|00002ed0| 6f 20 63 68 61 6e 67 65 | 20 74 68 69 73 2e 0d 09 |o change| this...|
|00002ee0| 20 20 2a 2f 0d 09 20 09 | 20 0d 09 20 09 20 61 73 | */.. .| .. . as|
|00002ef0| 6d 20 7b 0d 09 20 09 20 | 09 4d 4f 56 45 2e 4c 09 |m {.. . |.MOVE.L.|
|00002f00| 70 42 79 74 65 73 2c 44 | 30 09 3b 73 61 76 65 20 |pBytes,D|0.;save |
|00002f10| 74 68 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 62 79 |the numb|er of by|
|00002f20| 74 65 73 20 69 6e 20 74 | 68 65 20 70 61 72 61 6d |tes in t|he param|
|00002f30| 65 74 65 72 73 20 69 6e | 74 6f 20 44 30 0d 09 20 |eters in|to D0.. |
|00002f40| 09 20 09 55 4e 4c 4b 09 | 41 36 09 09 09 3b 75 6e |. .UNLK.|A6...;un|
|00002f50| 6c 69 6e 6b 69 6e 67 20 | 6c 65 61 76 65 73 20 72 |linking |leaves r|
|00002f60| 65 74 75 72 6e 20 61 64 | 64 72 20 61 74 20 74 68 |eturn ad|dr at th|
|00002f70| 65 20 74 6f 70 20 6f 66 | 20 74 68 65 20 73 74 61 |e top of| the sta|
|00002f80| 63 6b 0d 09 20 09 20 09 | 4d 4f 56 45 2e 4c 09 28 |ck.. . .|MOVE.L.(|
|00002f90| 53 50 29 2b 2c 41 30 09 | 3b 6d 6f 76 65 20 72 65 |SP)+,A0.|;move re|
|00002fa0| 74 75 72 6e 20 61 64 64 | 72 65 73 73 20 74 6f 20 |turn add|ress to |
|00002fb0| 72 65 67 69 73 74 65 72 | 20 41 30 0d 09 20 09 20 |register| A0.. . |
|00002fc0| 09 41 44 44 2e 4c 09 44 | 30 2c 53 50 09 09 3b 70 |.ADD.L.D|0,SP..;p|
|00002fd0| 6f 70 20 6f 6c 64 20 70 | 61 72 61 6d 65 74 65 72 |op old p|arameter|
|00002fe0| 73 20 6f 66 66 20 73 74 | 61 63 6b 0d 09 20 09 20 |s off st|ack.. . |
|00002ff0| 09 4a 4d 50 09 09 28 41 | 30 29 09 09 3b 6a 75 6d |.JMP..(A|0)..;jum|
|00003000| 70 20 74 6f 20 74 68 65 | 20 72 65 74 75 72 6e 20 |p to the| return |
|00003010| 61 64 64 72 65 73 73 0d | 09 20 09 20 7d 0d 7d 0d |address.|. . }.}.|
|00003020| 0d 23 69 6e 63 6c 75 64 | 65 20 22 4e 6f 74 69 66 |.#includ|e "Notif|
|00003030| 69 65 72 2e 63 22 09 2f | 2a 20 63 6f 6e 74 61 69 |ier.c"./|* contai|
|00003040| 6e 73 20 53 74 72 46 6f | 72 6d 61 74 20 61 6e 64 |ns StrFo|rmat and|
|00003050| 20 53 74 72 4e 6f 74 69 | 66 79 20 2a 2f 0d 0d 42 | StrNoti|fy */..B|
|00003060| 6f 6f 6c 65 61 6e 09 53 | 74 72 43 6f 6d 70 61 72 |oolean.S|trCompar|
|00003070| 65 28 20 53 74 72 32 35 | 35 20 73 74 72 31 2c 20 |e( Str25|5 str1, |
|00003080| 53 74 72 32 35 35 20 73 | 74 72 32 20 29 0d 7b 0d |Str255 s|tr2 ).{.|
|00003090| 09 2f 2a 09 54 68 69 73 | 20 66 75 6e 63 74 69 6f |./*.This| functio|
|000030a0| 6e 20 72 65 74 75 72 6e | 73 20 74 72 75 65 20 69 |n return|s true i|
|000030b0| 66 20 74 68 65 20 74 77 | 6f 20 73 74 72 69 6e 67 |f the tw|o string|
|000030c0| 73 20 73 65 6e 74 20 61 | 72 65 20 65 71 75 61 6c |s sent a|re equal|
|000030d0| 2e 20 20 54 68 65 20 63 | 6f 6d 70 61 72 69 73 6f |. The c|ompariso|
|000030e0| 6e 0d 09 20 2a 09 69 73 | 20 63 61 73 65 20 73 65 |n.. *.is| case se|
|000030f0| 6e 73 69 74 69 76 65 20 | 61 6e 64 20 74 72 61 69 |nsitive |and trai|
|00003100| 6c 69 6e 67 20 62 6c 61 | 6e 6b 73 20 61 72 65 20 |ling bla|nks are |
|00003110| 69 67 6e 6f 72 65 64 2e | 20 20 49 66 20 6f 6e 65 |ignored.| If one|
|00003120| 20 73 74 72 69 6e 67 20 | 69 73 20 6c 6f 6e 67 65 | string |is longe|
|00003130| 72 0d 09 20 2a 09 61 6e | 64 20 63 6f 6e 74 61 69 |r.. *.an|d contai|
|00003140| 6e 73 20 73 6f 6d 65 74 | 68 69 6e 67 20 4f 54 48 |ns somet|hing OTH|
|00003150| 45 52 20 74 68 61 6e 20 | 62 6c 61 6e 6b 73 20 61 |ER than |blanks a|
|00003160| 66 74 65 72 20 74 68 65 | 20 65 6e 64 20 6f 66 20 |fter the| end of |
|00003170| 74 68 65 20 6f 74 68 65 | 72 20 73 74 72 69 6e 67 |the othe|r string|
|00003180| 2c 0d 09 20 2a 09 74 68 | 65 20 66 75 6e 63 74 69 |,.. *.th|e functi|
|00003190| 6f 6e 20 77 69 6c 6c 20 | 72 65 74 75 72 6e 20 66 |on will |return f|
|000031a0| 61 6c 73 65 2e 0d 09 20 | 2a 2f 0d 0d 09 73 68 6f |alse... |*/...sho|
|000031b0| 72 74 09 73 68 6f 72 74 | 65 72 2c 09 2f 2a 20 77 |rt.short|er,./* w|
|000031c0| 68 69 63 68 20 73 74 72 | 69 6e 67 20 69 73 20 73 |hich str|ing is s|
|000031d0| 68 6f 72 74 65 72 3f 20 | 2a 2f 0d 09 09 09 65 6e |horter? |*/....en|
|000031e0| 64 53 68 6f 72 74 2c 09 | 2f 2a 20 6c 61 73 74 20 |dShort,.|/* last |
|000031f0| 63 68 61 72 61 63 74 65 | 72 20 6f 66 20 74 68 65 |characte|r of the|
|00003200| 20 73 68 6f 72 74 65 72 | 20 73 74 72 69 6e 67 20 | shorter| string |
|00003210| 2a 2f 0d 09 09 09 65 6e | 64 4c 6f 6e 67 3b 09 2f |*/....en|dLong;./|
|00003220| 2a 20 6c 61 73 74 20 63 | 68 61 72 61 63 74 65 72 |* last c|haracter|
|00003230| 20 6f 66 20 74 68 65 20 | 6c 6f 6e 67 65 72 20 73 | of the |longer s|
|00003240| 74 72 69 6e 67 20 2a 2f | 0d 09 42 6f 6f 6c 65 61 |tring */|..Boolea|
|00003250| 6e 09 72 65 73 75 6c 74 | 3b 0d 09 0d 09 72 65 73 |n.result|;....res|
|00003260| 75 6c 74 20 3d 20 74 72 | 75 65 3b 09 2f 2a 20 61 |ult = tr|ue;./* a|
|00003270| 73 73 75 6d 65 20 74 68 | 65 79 27 72 65 20 65 71 |ssume th|ey're eq|
|00003280| 75 61 6c 20 75 6e 74 69 | 6c 20 77 65 20 66 69 6e |ual unti|l we fin|
|00003290| 64 20 6f 74 68 65 72 77 | 69 73 65 20 2a 2f 0d 09 |d otherw|ise */..|
|000032a0| 0d 09 73 68 6f 72 74 65 | 72 20 3d 20 31 3b 0d 09 |..shorte|r = 1;..|
|000032b0| 65 6e 64 53 68 6f 72 74 | 20 3d 20 73 74 72 31 5b |endShort| = str1[|
|000032c0| 30 5d 3b 0d 09 65 6e 64 | 4c 6f 6e 67 20 3d 20 73 |0];..end|Long = s|
|000032d0| 74 72 32 5b 30 5d 3b 0d | 09 0d 09 69 66 20 28 20 |tr2[0];.|...if ( |
|000032e0| 73 74 72 32 5b 30 5d 20 | 3c 20 73 74 72 31 5b 30 |str2[0] |< str1[0|
|000032f0| 5d 20 29 0d 09 7b 0d 09 | 09 73 68 6f 72 74 65 72 |] )..{..|.shorter|
|00003300| 20 3d 20 32 3b 0d 09 09 | 65 6e 64 53 68 6f 72 74 | = 2;...|endShort|
|00003310| 20 3d 20 73 74 72 32 5b | 30 5d 3b 0d 09 09 65 6e | = str2[|0];...en|
|00003320| 64 4c 6f 6e 67 20 3d 20 | 73 74 72 31 5b 30 5d 3b |dLong = |str1[0];|
|00003330| 0d 09 7d 0d 09 0d 09 7b | 09 09 09 09 2f 2a 20 63 |..}....{|..../* c|
|00003340| 68 65 63 6b 20 65 61 63 | 68 20 6c 65 74 74 65 72 |heck eac|h letter|
|00003350| 20 74 6f 20 73 65 65 20 | 69 66 20 74 68 65 79 27 | to see |if they'|
|00003360| 72 65 20 65 71 75 61 6c | 20 2a 2f 0d 09 09 73 68 |re equal| */...sh|
|00003370| 6f 72 74 20 78 3b 0d 09 | 09 66 6f 72 20 28 20 78 |ort x;..|.for ( x|
|00003380| 20 3d 20 31 3b 20 78 20 | 3c 3d 20 65 6e 64 53 68 | = 1; x |<= endSh|
|00003390| 6f 72 74 3b 20 78 2b 2b | 20 29 0d 09 09 7b 0d 09 |ort; x++| )...{..|
|000033a0| 09 09 69 66 20 28 20 73 | 74 72 31 5b 78 5d 20 21 |..if ( s|tr1[x] !|
|000033b0| 3d 20 73 74 72 32 5b 78 | 5d 20 29 0d 09 09 09 7b |= str2[x|] )....{|
|000033c0| 0d 09 09 09 09 72 65 73 | 75 6c 74 20 3d 20 66 61 |.....res|ult = fa|
|000033d0| 6c 73 65 3b 09 2f 2a 20 | 6e 6f 74 20 65 71 75 61 |lse;./* |not equa|
|000033e0| 6c 20 2a 2f 0d 09 09 09 | 09 62 72 65 61 6b 3b 0d |l */....|.break;.|
|000033f0| 09 09 09 7d 0d 09 09 7d | 0d 09 7d 0d 09 0d 09 69 |...}...}|..}....i|
|00003400| 66 20 28 20 72 65 73 75 | 6c 74 20 29 09 2f 2a 20 |f ( resu|lt )./* |
|00003410| 63 68 65 63 6b 20 66 6f | 72 20 6e 6f 6e 2d 62 6c |check fo|r non-bl|
|00003420| 61 6e 6b 20 74 72 61 69 | 6c 69 6e 67 20 63 68 61 |ank trai|ling cha|
|00003430| 72 61 63 74 65 72 73 20 | 2a 2f 0d 09 7b 0d 09 09 |racters |*/..{...|
|00003440| 73 68 6f 72 74 20 78 3b | 0d 09 09 66 6f 72 20 28 |short x;|...for (|
|00003450| 20 78 20 3d 20 65 6e 64 | 53 68 6f 72 74 2b 31 3b | x = end|Short+1;|
|00003460| 20 78 20 3c 3d 20 65 6e | 64 4c 6f 6e 67 3b 20 78 | x <= en|dLong; x|
|00003470| 2b 2b 20 29 0d 09 09 7b | 0d 09 09 09 69 66 20 28 |++ )...{|....if (|
|00003480| 20 73 68 6f 72 74 65 72 | 20 3d 3d 20 31 20 29 0d | shorter| == 1 ).|
|00003490| 09 09 09 7b 0d 09 09 09 | 09 69 66 20 28 20 73 74 |...{....|.if ( st|
|000034a0| 72 32 5b 78 5d 20 21 3d | 20 27 20 27 20 29 0d 09 |r2[x] !=| ' ' )..|
|000034b0| 09 09 09 7b 0d 09 09 09 | 09 09 72 65 73 75 6c 74 |...{....|..result|
|000034c0| 20 3d 20 66 61 6c 73 65 | 3b 09 2f 2a 20 6e 6f 74 | = false|;./* not|
|000034d0| 20 61 20 62 6c 61 6e 6b | 20 2a 2f 0d 09 09 09 09 | a blank| */.....|
|000034e0| 09 62 72 65 61 6b 3b 0d | 09 09 09 09 7d 0d 09 09 |.break;.|....}...|
|000034f0| 09 7d 0d 09 09 09 65 6c | 73 65 0d 09 09 09 7b 0d |.}....el|se....{.|
|00003500| 09 09 09 09 69 66 20 28 | 20 73 74 72 31 5b 78 5d |....if (| str1[x]|
|00003510| 20 21 3d 20 27 20 27 20 | 29 0d 09 09 09 09 7b 0d | != ' ' |).....{.|
|00003520| 09 09 09 09 09 72 65 73 | 75 6c 74 20 3d 20 66 61 |.....res|ult = fa|
|00003530| 6c 73 65 3b 20 2f 2a 20 | 6e 6f 74 20 61 20 62 6c |lse; /* |not a bl|
|00003540| 61 6e 6b 20 2a 2f 0d 09 | 09 09 09 09 62 72 65 61 |ank */..|....brea|
|00003550| 6b 3b 0d 09 09 09 09 7d | 0d 09 09 09 7d 0d 09 09 |k;.....}|....}...|
|00003560| 7d 0d 09 7d 0d 09 72 65 | 74 75 72 6e 20 72 65 73 |}..}..re|turn res|
|00003570| 75 6c 74 3b 0d 7d 0d 0d | 00 00 00 00 00 00 00 00 |ult;.}..|........|
|00003580| 00 00 01 00 00 00 01 4c | 00 00 00 4c 00 00 00 32 |.......L|...L...2|
|00003590| 65 20 22 53 68 6f 77 49 | 63 6f 6e 46 61 6d 69 6c |e "ShowI|conFamil|
|000035a0| 79 2e 63 22 0d 3c 00 01 | a9 f0 06 ca 3f 3c 00 01 |y.c".<..|....?<..|
|000035b0| 09 4d 79 50 61 74 63 68 | 2e 63 02 00 00 00 50 61 |.MyPatch|.c....Pa|
|000035c0| 72 74 53 49 54 78 00 00 | 00 00 00 00 00 00 00 00 |rtSITx..|........|
|000035d0| 00 00 50 61 72 74 53 49 | 54 78 00 00 00 00 00 00 |..PartSI|Tx......|
|000035e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035f0| 00 00 aa da 77 98 00 00 | 00 00 00 00 01 7e 00 00 |....w...|.....~..|
|00003600| ff 30 00 b6 00 00 00 00 | 00 10 00 34 e1 74 00 00 |.0......|...4.t..|
|00003610| ff 30 00 b6 00 00 00 00 | 00 10 00 34 e1 74 00 00 |.0......|...4.t..|
|00003620| 00 00 00 00 00 02 00 00 | 00 90 00 34 e1 74 00 00 |........|...4.t..|
|00003630| 00 00 03 9e 68 64 00 00 | 00 6a 00 00 00 01 00 00 |....hd..|.j......|
|00003640| 00 02 01 00 00 00 00 00 | c0 00 00 00 00 00 00 00 |........|........|
|00003650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003660| 63 6f 72 65 63 72 65 6c | 00 01 38 3a 70 73 6e 20 |corecrel|..8:psn |
|00003670| 00 00 00 08 00 00 00 00 | 00 00 00 02 61 65 76 74 |........|....aevt|
|00003680| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....|
|00003690| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000036a0| 00 00 00 00 00 00 00 06 | 00 04 00 2a 00 03 01 dd |........|...*....|
|000036b0| 02 7d 00 38 00 14 01 d6 | 02 40 aa b8 fd 5e 00 00 |.}.8....|.@...^..|
|000036c0| 20 16 00 00 20 16 00 00 | 00 00 00 00 00 00 01 00 | ... ...|........|
|000036d0| 00 00 01 4c 00 00 00 4c | 00 00 00 32 00 a6 c4 38 |...L...L|...2...8|
|000036e0| 10 2a 00 00 00 1c 00 32 | 00 00 4d 50 53 52 00 00 |.*.....2|..MPSR..|
|000036f0| 00 0a 03 ed ff ff 00 00 | 00 00 00 a6 c5 20 00 00 |........|..... ..|
+--------+-------------------------+-------------------------+--------+--------+